当前位置:首页 » 操作系统 » powerdesigner生成数据库

powerdesigner生成数据库

发布时间: 2023-09-08 19:15:31

㈠ 如何利用powerdesigner自动生成一个具有外键的数据库

Powerdesigner对于一个刚开始接触的人,需要知道和了解的是操作,只有操作会了才会慢慢理解其中含义,而不是一来就讲发展背景,原理等等一大堆,后来也记不住,先把操作记清楚了,这些含义和原理会再不断的学习中显现出来,那时候再深究就会很深刻。
第一步:建立模型:
clip_image002
第二步,选择物理模型进行创建工作空间
clip_image004
第三:生成后的工作空间:
clip_image006
第四步,简单了解工具栏中的相关工具操作
clip_image008
第五步,实际建立一个空表
clip_image010
第六步:在表中放入表名
clip_image012
第七步:在表中放入相应的字段名,数据类型,字段长,主外键
clip_image014
最后按确定即可完成一个表。
第八步:继续建立一个表,步骤和之前一样
clip_image016
第九步:将两个表关联起来,通过工具中的关系进行自动生成外键
clip_image018
第十步:生成外键之后的物理模型图
clip_image020
第十一步:生成数据库
clip_image022
第十二步:生成数据库时的一些数据库文件名和路径的编辑
clip_image024
第十三:数据库文件生成完毕。
clip_image026
桌面上会出现这样一份文件:
clip_image028
将数据库文件右击txt打开时会看到sql语句:
/*==============================================================*/
/* DBMS name: Sybase SQL Anywhere 11 */
/* Created on: 2012/4/20 9:57:13 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role=’FK_CLASS_REFERENCE_USER’) then
alter table class
delete foreign key FK_CLASS_REFERENCE_USER
end if;
if exists(
select 1 from sys.systable
where table_name=’class’
and table_type in (‘BASE’, ‘GBL TEMP’)
) then
drop table class
end if;
if exists(
select 1 from sys.systable
where table_name=’user’
and table_type in (‘BASE’, ‘GBL TEMP’)
) then
drop table "user"
end if;
/*==============================================================*/
/* Table: class */
/*==============================================================*/
create table class
(
class_id varchar(64) not null,
class_name varchar(64) null,
user_id varchar(64) null,
constraint PK_CLASS primary key clustered (class_id)
);
comment on column class.class_id is
‘班级ID’;
comment on column class.class_name is
‘班级名’;
comment on column class.user_id is
‘用户ID’;
/*==============================================================*/
/* Table: "user" */
/*==============================================================*/
create table "user"
(
user_id varchar(64) not null,
user_name varchar(64) null,
password varchar(64) null,
constraint PK_USER primary key clustered (user_id)
);
comment on column "user".user_id is
‘用户ID’;
comment on column "user".user_name is
‘用户名’;
comment on column "user".password is
‘密码’;
alter table class
add constraint FK_CLASS_REFERENCE_USER foreign key (user_id)
references "user" (user_id)
on update restrict
on delete restrict;
至此,如何利用powerdesigner自动生成,建立一个具有外键的数据库操作就完成了!
转载,仅供参考。

热点内容
如何看见真我手机的全部配置 发布:2025-09-18 18:48:10 浏览:966
战地5默认是什么服务器 发布:2025-09-18 17:59:32 浏览:301
安卓变ios系统主题怎么弄 发布:2025-09-18 17:54:07 浏览:880
linux出口ip 发布:2025-09-18 17:51:57 浏览:941
androidbitmap使用 发布:2025-09-18 17:49:20 浏览:235
数字日期加密 发布:2025-09-18 17:43:46 浏览:500
网吧电脑显示未连接上桌面服务器 发布:2025-09-18 17:37:17 浏览:698
电脑压缩文件怎么解压 发布:2025-09-18 17:27:59 浏览:387
数据库数据类型表 发布:2025-09-18 17:11:56 浏览:31
java如何生产执行bat脚本 发布:2025-09-18 16:53:25 浏览:562