当前位置:网站首页>SQL is used for field data types in various databases
SQL is used for field data types in various databases
2022-06-25 18:36:00 【ookaoooo】
Microsoft Access、MySQL and SQL Server The type and range of data used .
Microsoft Access data type
| data type | describe | Storage |
|---|---|---|
| Text | For text or a combination of text and numbers . | most 255 Characters . |
| Memo | Memo For a larger number of texts . Maximum storage 65,536 Characters . notes : Be able to memo Field to sort . But they are searchable . | |
| Memo | Memo For a larger number of texts . Maximum storage 65,536 Characters . notes : Be able to memo Field to sort . But they are searchable . | |
| Byte | allow 0 To 255 The number of . | 1 byte |
| Integer | Allow between -32,768 And 32,767 All the numbers between . | 2 byte |
| Long | Allow between -2,147,483,648 And 2,147,483,647 All the numbers between . | 4 byte |
| Single | Single precision floating point . Handle most decimals . | 4 byte |
| Double | Double precision floating point . Handle most decimals . | 8 byte |
| Currency | For money . Support 15 Bitwise element , Plus 4 Decimal place . Tips : You can choose which currency to use . | 8 byte |
| AutoNumber | AutoNumber Fields automatically assign numbers to each record , Usually from 1 Start . | 4 byte |
| Date/Time | For date and time | 8 byte |
| Yes/No | Logical fields , It can be shown as Yes/No、True/False or On/Off. In the code , Use a constant True and False ( Equivalent to 1 and 0). notes :Yes/No The... Is not allowed in the field Null value | 1 The bit |
| Ole Object | Can store pictures 、 Audio 、 Video or something BLOBs(Binary Large OBjects). | most 1GB |
| Hyperlink | Contains links to other files , Including web pages . | |
| Lookup Wizard | Allows you to create a list of options that can be selected from the drop-down list . | 4 byte |
MySQL data type
stay MySQL in , There are three main types :Text( Text )、Number( Numbers ) and Date/Time( date / Time ) type .
Text type :
| data type | describe |
|---|---|
| CHAR(size) | Saves a fixed length string ( Can contain letters 、 Numbers and special characters ). Specify the length of the string in parentheses . most 255 Characters . |
| VARCHAR(size) | Save variable length strings ( Can contain letters 、 Numbers and special characters ). Specify the maximum length of the string in parentheses . most 255 Characters . notes : If the length of the value is greater than 255, Is converted to TEXT type . |
| TINYTEXT | The maximum storage length is 255 Character string . |
| TEXT | The maximum storage length is 65,535 Character string . |
| BLOB | be used for BLOBs(Binary Large OBjects). Store up to 65,535 Bytes of data . |
| MEDIUMTEXT | The maximum storage length is 16,777,215 Character string . |
| MEDIUMBLOB | be used for BLOBs(Binary Large OBjects). Store up to 16,777,215 Bytes of data . |
| LONGTEXT | The maximum storage length is 4,294,967,295 Character string . |
| LONGBLOB | be used for BLOBs (Binary Large OBjects). Store up to 4,294,967,295 Bytes of data . |
| ENUM(x,y,z,etc.) | Allows you to enter a list of possible values . Can be in ENUM List the largest 65535 It's worth . If there is no inserted value in the list , Then insert a null value . notes : The values are sorted in the order you enter . You can enter the possible values in this format : ENUM('X','Y','Z') |
| SET | And ENUM similar , The difference is ,SET It can only contain at most 64 List items and SET Can store more than one choice . |
Number type :
| data type | describe |
|---|---|
| TINYINT(size) | Signed -128 To 127 , Unsigned 0 To 255. |
| SMALLINT(size) | Signed range -32768 To 32767, Unsigned 0 To 65535, size The default is 6. |
| MEDIUMINT(size) | Signed range -8388608 To 8388607, The unsigned range is 0 To 16777215. size The default is 9 |
| INT(size) | Signed range -2147483648 To 2147483647, The unsigned range is 0 To 4294967295. size The default is 11 |
| BIGINT(size) | The signed range is -9223372036854775808 To 9223372036854775807, The unsigned range is 0 To 18446744073709551615.size The default is 20 |
| FLOAT(size,d) | A small number with a floating decimal point . stay size The parameter specifies the maximum number of digits to be displayed . stay d The parameter specifies the maximum number of digits to the right of the decimal point . |
| DOUBLE(size,d) | A large number with a floating decimal point . stay size The parameter shows the fixed maximum number of digits . stay d The parameter specifies the maximum number of digits to the right of the decimal point . |
| DECIMAL(size,d) | Stored as a string DOUBLE type , Allow fixed decimal point . stay size The parameter specifies the maximum number of digits to be displayed . stay d The parameter specifies the maximum number of digits to the right of the decimal point . |
Be careful : The above size It doesn't represent the specific length stored in the database , Such as int(4) It's not just storage 4 A number of lengths .
actually int(size) It doesn't matter how much storage space it takes .int(3)、int(4)、int(8) It's all on disk 4 btyes Storage space . It's just that the way it's displayed to users is a little different ,int(M) Follow int The data type is the same .
for example :
1、int The value of is 10 ( Appoint zerofill)
int(9) The result is 000000010
int(3) The result is 010
It's just that the length of the display is not the same All take up four bytes of space Date type :
| data type | describe |
|---|---|
| DATE() | date . Format :YYYY-MM-DD notes : The scope of support is from '1000-01-01' To '9999-12-31' |
| DATETIME() | * A combination of date and time . Format :YYYY-MM-DD HH:MM:SS notes : The scope of support is from '1000-01-01 00:00:00' To '9999-12-31 23:59:59' |
| TIMESTAMP() | * Time stamp .TIMESTAMP Value usage Unix An era ('1970-01-01 00:00:00' UTC) Seconds to date to store . Format :YYYY-MM-DD HH:MM:SS notes : The scope of support is from '1970-01-01 00:00:01' UTC To '2038-01-09 03:14:07' UTC |
| TIME() | Time . Format :HH:MM:SS notes : The scope of support is from '-838:59:59' To '838:59:59' |
| YEAR() | 2 Bit or 4 Bit format year . notes :4 Value allowed by bit format :1901 To 2155.2 Value allowed by bit format :70 To 69, From 1970 To 2069. |
* Even if DATETIME and TIMESTAMP Return the same format , They work in very different ways . stay INSERT or UPDATE Querying ,TIMESTAMP Automatically set itself to the current date and time .TIMESTAMP Also accept different formats , such as YYYYMMDDHHMMSS、YYMMDDHHMMSS、YYYYMMDD or YYMMDD.
SQL Server data type
String type :
| data type | describe | Storage |
|---|---|---|
| char(n) | Fixed length string . most 8,000 Characters . | Defined width |
| varchar(n) | Variable length string . most 8,000 Characters . | 2 bytes + number of chars |
| varchar(max) | Variable length string . most 1,073,741,824 Characters . | 2 bytes + number of chars |
| text | Variable length string . most 2GB Text data . | 4 bytes + number of chars |
| nchar | Fixed length Unicode character string . most 4,000 Characters . | Defined width x 2 |
| nvarchar | Variable length Unicode character string . most 4,000 Characters . | |
| nvarchar(max) | Variable length Unicode character string . most 536,870,912 Characters . | |
| ntext | Variable length Unicode character string . most 2GB Text data . | |
| bit | allow 0、1 or NULL | |
| binary(n) | Fixed length binary string . most 8,000 byte . | |
| varbinary | Variable length binary string . most 8,000 byte . | |
| varbinary(max) | Variable length binary string . most 2GB. | |
| image | Variable length binary string . most 2GB. |
Number type :
| data type | describe | Storage | |
|---|---|---|---|
| tinyint | Allow from 0 To 255 All the numbers of . | 1 byte | |
| smallint | Allow between -32,768 And 32,767 All the numbers of . | 2 byte | |
| int | Allow between -2,147,483,648 And 2,147,483,647 All the numbers of . | 4 byte | |
| bigint | Allow between -9,223,372,036,854,775,808 And 9,223,372,036,854,775,807 All numbers between . | 8 byte | |
| decimal(p,s) | Fixed precision and scale figures .</br> Allow from -10^38 +1 To 10^38 -1 Number between .</br>p Parameter indicates the maximum number of bits that can be stored ( To the left and right of the decimal point ).p Must be 1 To 38 Between the value of the . The default is 18.</br>s Parameter indicates the maximum number of digits stored to the right of the decimal point .s Must be 0 To p Between the value of the . The default is 0. | 5-17 byte | |
| numeric(p,s) | Fixed precision and scale figures .</br> Allow from -10^38 +1 To 10^38 -1 Number between .</br>p Parameter indicates the maximum number of bits that can be stored ( To the left and right of the decimal point ).p Must be 1 To 38 Between the value of the . The default is 18.</br>s Parameter indicates the maximum number of digits stored to the right of the decimal point .s Must be 0 To p Between the value of the . The default is 0. | 5-17 byte | |
| smallmoney | Be situated between -214,748.3648 And 214,748.3647 Currency data between . | 4 byte | |
| money | Be situated between -922,337,203,685,477.5808 And 922,337,203,685,477.5807 Currency data between . | 8 byte | |
| float(n) | from -1.79E + 308 To 1.79E + 308 The floating precision of digital data .</br>n Parameter indicates that the field saves 4 Byte or 8 byte .float(24) preservation 4 byte , and float(53) preservation 8 byte .n The default value of is 53. | 4 or 8 byte | |
| real | from -3.40E + 38 To 3.40E + 38 The floating precision of digital data . | 4 byte |
Date type :
| data type | describe | Storage |
|---|---|---|
| datetime | from 1753 year 1 month 1 Japan To 9999 year 12 month 31 Japan , Accuracy of 3.33 millisecond . | 8 byte |
| datetime2 | from 1753 year 1 month 1 Japan To 9999 year 12 month 31 Japan , Accuracy of 100 nanosecond . | 6-8 byte |
| smalldatetime | from 1900 year 1 month 1 Japan To 2079 year 6 month 6 Japan , Accuracy of 1 minute . | 4 byte |
| date | Store date only . from 0001 year 1 month 1 Japan To 9999 year 12 month 31 Japan . | 3 bytes |
| time | Storage time only . Accuracy of 100 nanosecond . | 3-5 byte |
| datetimeoffset | And datetime2 identical , Plus time zone offset . | 8-10 byte |
| timestamp | Store unique numbers , Whenever a line is created or modified , The number will be updated .timestamp Value based on internal clock , It doesn't correspond to the real time . Each watch can only have one timestamp Variable . |
Other data types :
| data type | describe | |
|---|---|---|
| sql_variant | Store the most 8,000 Byte data of different data types , except text、ntext as well as timestamp. | |
| uniqueidentifier | Store globally unique identifier (GUID). | |
| xml | Storage XML Format data . most 2GB. | |
| cursor | Store references to pointers used for database operations . | |
| table | Save the result set , For later processing . |
边栏推荐
- Comparison rules of strings in JS
- el-table高度自适应
- 158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
- [elt.zip] openharmony paper Club - witness file compression system erofs
- LeetCode-101-对称二叉树
- 网络安全检测与防范 测试题(五)
- 华为发布两大昇腾计划 推动AI人才发展和科研创新
- [elt.zip] openharmony paper Club - memory compression for data intensive applications
- 【深入理解TcaplusDB技术】TcaplusDB新增机型
- Basic operation details of binary search tree (BST) (complete code, including test cases)
猜你喜欢

. How to exit net worker service gracefully
![Analysis of global tea production, consumption and import and export trade: China's tea production ranks first in the world [figure]](/img/16/ab5056dd26cf7b1a761a92eea46e54.jpg)
Analysis of global tea production, consumption and import and export trade: China's tea production ranks first in the world [figure]

anaconda下载清华源
![[in depth understanding of tcapulusdb technology] business guide for creating doc acceptance](/img/e5/9c902f5d6aaeb7113e82d2c1084005.png)
[in depth understanding of tcapulusdb technology] business guide for creating doc acceptance

【深入理解TcaplusDB技术】如何实现Tmonitor单机安装
![Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]](/img/2e/439b5dce9634d4015430c9cf06c5de.jpg)
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]

158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts
![Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]](/img/d1/8ed2958ef365e17494bade6e29ee04.jpg)
Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]

Redis6
![[deeply understand tcapulusdb technology] create a game zone](/img/91/cf4eae9a4336ca407c0da805b9d909.png)
[deeply understand tcapulusdb technology] create a game zone
随机推荐
[in depth understanding of tcapulusdb technology] tcapulusdb regular documents
Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]
electron 基础项目搭建 &&主线程和渲染线程的通信
网络安全检测与防范 测试题(一)
06 local method interface
Training of long and difficult sentences in postgraduate entrance examination day84
RMAN备份数据库_使用RMAN做拆分镜像(split mirror)备份
[in depth understanding of tcapulusdb technology] how to realize single machine installation of tmonitor
connect to address IP: No route to host
LeetCode-78-子集
《痞子衡嵌入式半月刊》 第 57 期
初探Oracle全栈虚拟机---GraalVM
想知道新股民怎样炒股票开户?在线开户安全么?
Pycharm 使用过程中碰到问题
Svn introduction and Usage Summary
【深入理解TcaplusDB技术】 Tmonitor模块架构
RMAN backup database_ Restart RMAN backup
TCP/IP 测试题(一)
Batch uploading of local jar packages to nexus private server
RMAN backup database_ catalogue