【设置日期默认值、设置id自增】
【注意有备注添加备注COMMENT】
CREATE TABLE user_info_vip( id int(11) primary key auto_increment comment "自增ID", -- 主键默认不允许为空 uid int(11) unique key 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 "注册时间" -- current_timestamp表示当前 )DEFAULT CHARSET=UTF8
ALTER TABLE user_info ADD COLUMN school VARCHAR(15) AFTER level; ALTER TABLE user_info RENAME COLUMN job TO profession; ALTER TABLE user_info MODIFY COLUMN profession VARCHAR(10) COMMENT ""; ALTER TABLE user_info MODIFY COLUMN achievement INT(11) DEFAULT 0 COMMENT "";
DROP TABLE IF EXISTS exam_record_2011; DROP TABLE IF EXISTS exam_record_2012; DROP TABLE IF EXISTS exam_record_2013; DROP TABLE IF EXISTS exam_record_2014;
CREATE INDEX idx_duration ON examination_info(duration); CREATE UNIQUE INDEX uniq_idx_exam_id ON examination_info(exam_id); CREATE FULLTEXT INDEX full_idx_tag ON examination_info(tag); -- ON 表(列)
DROP INDEX uniq_idx_exam_id ON examination_info; DROP INDEX full_idx_tag ON examination_info;