题解 | #创建一张新表#
创建一张新表
https://www.nowcoder.com/practice/a61ee5519d14444aa99e530309a8e043
create table if not exists user_info_vip(
id int(11) not null primary key auto_increment comment'自增ID',
uid int(11) not null unique 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'注册时间'
) default charset=utf8
知识点:
- 主键的值非空且唯一.
- unique的值唯一但不一定非空.
- 创建表时,最后的字符集一定要default charset=utf8,不然报错.
- 开头:create table if not exists tb_name.
