create table t_user(
user_id int primary key auto_increment, # 主鍵id
username varchar(20) not null unique, # 用戶名
email varchar(30) not null unique, # 郵箱
password varchar(20) not null, # 密碼
mobile varchar(20) not null, # 手機號
role varchar(20) not null, # 身份
status int not null, # 狀態
create_time datetime, # 創建時間
# 更新時間 只要表中有一個字段更新此字段(update_time)更新
update_time timestamp null default current_timestamp on update current_timestamp
)
SELECT * from t_user
INSERT into t_user VALUES(null,'aaa','123@qq.com','123456','123123','普通用戶',1,NOW(),DEFAULT)
INSERT into t_user VALUES(null,'bbb','456@qq.com','123456','123123','普通用戶',1,NOW(),DEFAULT)
INSERT into t_user VALUES(null,'ccc','798@qq.com','123456','123123','普通用戶',1,NOW(),DEFAULT)
update t_user set username='xiaohong' where user_id=1
效果圖
