1.安装PowerDesigner
转载:https://blog.youkuaiyun.com/weixin_51621120/article/details/124632754
2. 创建数据模型
PowerDesigner可以生成数据库设计文档以及SQL语句
3.设计表
选择箭头后,双击table
最后点击ok
调整顺序
同理设置主键
最终得到一张表的SQL
drop index IDX_GIRLS_3 on T_GIRLS;
drop index IDX_GIRLS_2 on T_GIRLS;
drop index IDX_GIRLS_1 on T_GIRLS;
drop table if exists T_GIRLS;
/*==============================================================*/
/* Table: T_GIRLS */
/*==============================================================*/
create table T_GIRLS
(
id bigint not null comment '主键,不为空',
name varchar(30) not null comment '超女姓名,中文名',
weight numeric(5,2) comment '体重,单位:kg',
btime datetime default CURRENT_TIMESTAMP comment '报名时间',
pic longblob comment '照片',
rsts numeric(1) comment '记录状态,1-启用,2-禁用,default 1',
keyid int auto_increment comment '记录编号,自增字段',
primary key (id),
key AK_K_GIRLS_KEYID (keyid)
);
alter table T_GIRLS comment '本表存放了超女基本信息';
/*==============================================================*/
/* Index: IDX_GIRLS_1 */
/*==============================================================*/
create index IDX_GIRLS_1 on T_GIRLS
(
name
);
/*==============================================================*/
/* Index: IDX_GIRLS_2 */
/*==============================================================*/
create index IDX_GIRLS_2 on T_GIRLS
(
rsts
);
/*==============================================================*/
/* Index: IDX_GIRLS_3 */
/*==============================================================*/
create unique index IDX_GIRLS_3 on T_GIRLS
(
rsts
);