非二进制字符串数据:CHAR,VARCHAR,TEXT
| Type | Storage requied | Maximum Length |
| CHAR(M) | M characters | 255 characters |
| Type | Storage requied | Maximum Length |
| Varchar(M) | L characters plus 1 to 2 bytes | |
| Type | Storage requied | Maximum Length |
| TinyText | L character +1 bytes | |
| Text | L character +2bytes | |
| MediumText | L character +3bytes | |
| LongText | L character +4bytes |
二進制數據
Binary varbinary blob為二進制數據,沒有字符和排序規則,binary是一個固定長度的數據類型,長度應給是0 to 255.如果不能達到存儲的長度需要添加空格。末尾的空格被去除重新選擇出是。Binary不適合存儲末尾含有空格的數據。如:加密的字符串恰巧含有空格時,獲得值和存儲的值會不同。
varbinary 是變長度的數據類型,最大長度能夠達到65535.末尾的空格不能被移除。
Blob數據類型與四中不同的尺寸,存儲的最大長度是不同的。會增加1 to 4個字節來記錄值的長度。
下表:M代表最大的長度,L代表真實的給定值
Type Storage Required Maximu length
Binary(M) Mbytes 255bytes
varbianry(M) L bytes plus 1 or 2 bytes 65535
TinyBLOB L+1 bytes 255bytes
BLOB L+2 bytes 65535
MedinmBlob L+3bytes 167777
LongBlob L+4 bytes 4,294,967,295
# The Enum and Set數據類型
1. 被選擇從固定的數據。
create table boolean{
yesno enum(’Y‘,’N'),
truefalse enum(‘T’,‘F')
}
Create Table allergy{
symptom set('sneezing','runny nose','stuffy head','red eyes')
}
Insert into allery (symtom) values('');
insert into allery (sysmptom) values('stuffy head');
insert into allery (sysmtom) values ('sneezing,red eyes');
總結
以上是生活随笔為你收集整理的非二进制字符串数据:CHAR,VARCHAR,TEXT的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2.7 Client Commands
- 下一篇: 日期类型