PowerDesigner——MySql

正向工程:
CDM(概念模型)——>PDM(物理模型)——>**.sql

 

/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2009-7-3 13:56:52                            */
/*==============================================================*/

drop table if exists member;

drop table if exists member_type;

/*==============================================================*/
/* Table: member                                                */
/*==============================================================*/
create table member
(
   memberID             int not null,
   memberTypeID         int,
   memberName           varchar(254),
   primary key (memberID)
);

alter table member comment '会员表';

/*==============================================================*/
/* Table: member_type                                           */
/*==============================================================*/
create table member_type
(
   memberTypeID         int not null,
   memberTypeName       varchar(254),
   primary key (memberTypeID)
);

alter table member_type comment '会员类型表';

alter table member add constraint FK_MEMBER_RELATIONS_MEMBER_TYPE foreign key (memberTypeID)
      references member_type (memberTypeID) on delete restrict on update restrict;

 

 

你可能感兴趣的:(sql,mysql)