Numeric type
type | memory space size | Indicates the range | illustrate |
---|---|---|---|
tinyint | 1byte | Signed -128~ 127 Unsigned 0~255 | Extra small integer (can hold human age) |
smallint | 2byte(16bit) | Signed: -32768~32767 Unsigned 0~65535 | small integer |
mediumint | 3byte | medium integer | |
int/integer | 4byte | integer | |
bigint | 8byte | large integer | |
float | 4byte | single precision | |
double | 8byte | double precision | |
decimal | +2 for the first parameter | Commonly used in price decimal(10,2) represents up to 8 integers and must guarantee 2 decimal places |
character type
type of character series
type | Character length (bytes) | illustrate |
---|---|---|
char | 0-255 | Fixed-length string, can store up to 255 characters; when the specified field is char(n) The longest data in this column is n characters. If the added data is a less than n, it will automatically add na '\u0000' |
varchar | 0-2^16-1 | Variable length string, the maximum length of this type is 2^16-1 |
tinyblob | 0-255 | access binary string |
blob | 0-2^16-1 | access binary string |
mediumblob | 0-2^24-1 | access binary string |
longblob | 0-2^32-1 | access binary string |
tinytext | 0-255 | text data (string) |
text | 0-2^16-1 | text data (string) |
mediuntext | 0-2^24-1 | text data (string) |
longtext | 0-2^32-1 | text data (string) |
date type
Because many scenarios need to query the data of a certain period of time based on the date, this type came into being.
type | Format | illustrate |
---|---|---|
date | 2022-05-30 | Date only stores year month day |
time | 12:00:00 | time only stores time |
datetime | 2022-05-30 12:00:00 | date+time |
timestamp | 20220530120000 | date+time (timestamp) |
Reference: bilibili
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。