Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
granite
kb
Wiki
Best_practice
create_table
create_table
· Changes
Page history
搬运lake.wiki中的内容
authored
Feb 22, 2021
by
吴一博
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
best_practice/create_table.md
best_practice/create_table.md
+9
-0
No files found.
best_practice/create_table.md
0 → 100644
View page @
06367b0a
# 表字符集
一般建表时的默认字符集为utf8,若如此,向表中导入超过3个字节的汉字时,会报非法字符的错误
*
将表的默认字符集设为utf8mb4
*
修改已有表的字符集可用语句: alter table {table} convert to character set utf8mb4; 该语句将复制表,速度慢
# 字段类型及约束
*
能够设置为int类型的字段不要设为varchar
*
作为唯一键的字段要设置非空约束,并设置默认值
\ No newline at end of file