题解 | #创建一张新表#
创建一张新表
https://www.nowcoder.com/practice/a61ee5519d14444aa99e530309a8e043
CREATE TABLE IF NOT EXISTS user_info_vip ( id int(11) PRIMARY KEY AUTO_INCREMENT Comment'自增ID', uid int(11) UNIQUE NOT NULL Comment'用户ID', nick_name VARCHAR(64) Comment'昵称', achievement int(11) DEFAULT 0 Comment'成就值', level int(11) Comment'用户等级', job VARCHAR(32) Comment'职业方向', register_time DATETIME DEFAULT CURRENT_TIMESTAMP Comment'注册时间' )CHARACTER SET utf8 COLLATE utf8_general_ci;
习惯性在创建表时写IF NOT EXISTS
,注意添加注释Comment'xxx'
,默认编码格式utf8 CHARACTER SET utf8
,数据库校对规则设为utf8_general_ci(不区分大小写) COLLATE utf8_general_ci
PS:utf8_general_ci中,ci为case insensitive的缩写,即大小写不敏感。utf8_general_cs区分大小写,cs为case sensitive的缩写,即大小写敏感。utf8_bin将字符串中的每一个字符用二进制数据存储,区分大小写。