This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14137|Reply: 2

[Source] MySQL table field type attributes are explained in detail

[Copy link]
Posted on 7/16/2017 10:40:39 AM | | | |
1. Number type
type
range
illustrate

Char(N) [binary]N=1~255 characters
binary: case-sensitive
Fixed lengthstd_name cahr(32) not null
VarChar(N) [binary]N=1~255 characters
binary: case-sensitive
Variable lengthstd_address varchar(256)
TinyBlobMaximum length 255 characters (2^8-1)Blobs (Binary large objects) store binary data and are case-sensitive
memo text not null
TinyTextMaximum length 255 characters (2^8-1)
BlobMaximum length 65535 characters (2^16-1)
TextMaximum length 65535 characters (2^16-1)
MediumBlobMaximum length of 16777215 characters (2^24-1)
MediumTextMaximum length of 16777215 characters (2^24-1)
LongBlobMaximum length 4294967295 characters (2^32-1)
LongTextMaximum length 4294967295 characters (2^32-1)
EnumThe maximum number of sets is 65535Enumeration, Enum single selection, Set multiselectionsex enum(1,0)
habby set ('play video games', 'sleep', 'watch movies', 'listen to music')
SetThe maximum number of sets is 64
Distinguish between Null and Not Null: Null is the null value that allows storage (Null)
2. Numerical values
type
range
illustrate
For example
TinyInt[M] [UNSIGNED]-128~127
UNSIGNED : 0~255

num tinyint unsigned
SmallInt[M] [UNSIGNED]-32768~32767
UNSIGNED :0~ 65535


MediumInt[M] [UNSIGNED]-8388608~8388607
UNSIGNED :0~16777215


Int[M] [UNSIGNED]-2^31~2^31-1
UNSIGNED : 0~2^32


BigInt[M] [UNSIGNED]-2^63~2^63-1
UNSIGNED : 0~2^64


Float [(M,D)]-3.4E+38~3.4E+38( approx. )
Note: M is the length, D is the decimal, Float 4 bytes, Double 8 bytes
Double [(M,D)]-1.79E+308~1.79E+308( approx. )
Decimal [(M,D)]
Identify ZeroFill: Declare the keyword ZeroFill to be auto-filled 0, such as 000021
3. Date and time

type
range
illustrate
DateDate (yyyy-mm-dd)
TimeTime (hh:mm:ss)
DateTimeDate and time combination (yyyy-mm-dd hh:mm:ss)
TimeStampyyyymmddhhmmss
YearVintage yyyy






Previous:Chief Experience Officer of Yali Mini Program: 300 seconds will take you to see through the big world of mini programs
Next:The difference between engine=innodb and engine=myisam in mysql
 Landlord| Posted on 7/16/2017 10:41:01 AM |
PRI primary key constraints;

UNI sole binding;

MUL can be repeated
 Landlord| Posted on 7/16/2017 10:56:30 AM |
In MySQL, if you want to tell others how to build a table, just a screenshot of the table structure cannot convey the structure of the table well, far less powerful than a table creation statement.
You can use the following SQL statement to export a table creation statement that already exists in MySQL.






Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com