create table t_demo
(
id int unsigned not null auto_increment comment 'ID主键',
name varchar(20) not null default '' comment '姓名',
sex char(1) not null default '' comment '性别(男,女)',
age smallint not null default 0 comment '年龄',
address varchar(100) not null default '' comment '地址',
phone varchar(20) not null default '' comment '电话',
deleted tinyint not null DEFAULT 0 COMMENT '是否删除 0 未删除 1 删除 默认是0',
create_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间,默认当前时间',
update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '记录更新时间,默认当前时间',
primary key(id),
unique key uni_phone(phone),
index idx_name(name),
index idx_address(address(20)),
index idx_create_time(create_time),
index idx_update_time(update_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci comment 't_demo';