create tables for mysql5 by PowerDesigner15

First,  create concept-data-model.

And then generate Physical Data Model from Concept-Data-Model.

But there is something that we should pay attention to. I record them as follows.

1. avoiding use mysql keywords like  "desc" as column name.

you can use `desc` to avoid keyword conflict if you insist.

But I recommend you to use another word liking explain,  addition.

2. set charset utf-8  and set auto_increment   

my target:

 1 /*==============================================================*/
 2 /* Table: student                                       */
 3 /*==============================================================*/
 4 create table student
 5 (
 6    id                   int not null auto_increment,
 7    rank_name            varchar(80) not null,
 8  
 9    primary key (id)
10 )
11 auto_increment = 1
12 charset = UTF8;

1) create db using charset utf-general_ci

2) set charset for tables.

  1. 最新版的PD15中可能没有charset =(GBK)这一项,如果没有的话请按照下面的步骤进行手动添加
  2. 1、在PD安装目录下(我的PD安装路径是:C:Program FilesSybasePowerDesigner 15),找到Resource Files文件夹,在Resource Files中有个DBMS文件夹,找到里面的mysql50.xdb文件,用记事本打开。
  3. 2、按Ctrl+F键输入"checksum = %d : list = 0 | 1, default = 0",在其前方加入"charset = %s : list = UTF8 | GBK | GB2312, default = UTF8"如下图:

     4. create  physical-data-model;  select  Databases > Default Physical Options 

 

3. set auto_increment  = 1, which means increment from 1.

refering to step2.

4. set auto_increment for id.

use the physical data model and do as following instruction.

powerdesigner中怎么给一主键设为自增型auto_increment-针对于Mysql数据库

在你所要设为自增型的键上(比如你的id)双击,弹出一个Column Properties对话框,右下角有一个Identify的选择框,选中它OK,就可以了。
再去查看Preview,就能看到用大写标识出来的AUTO_INCREMENT。

 

Done! 

原文地址:https://www.cnblogs.com/harrysun/p/3234043.html