當前位置:首頁 » 操作系統 » 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-07-10 09:26:56 瀏覽:917
密碼編譯找規律 發布:2025-07-10 09:18:10 瀏覽:511
電影視頻緩存後 發布:2025-07-10 09:16:48 瀏覽:893
伺服器搭建需要哪些東西 發布:2025-07-10 09:15:23 瀏覽:801
無限密碼怎麼改 發布:2025-07-10 09:14:32 瀏覽:104
coc按鍵精靈腳本 發布:2025-07-10 09:12:40 瀏覽:312
excel表格ftp函數 發布:2025-07-10 09:05:50 瀏覽:276
u2game的解壓密碼 發布:2025-07-10 09:05:14 瀏覽:597
c語言編譯器ide蘋果下載 發布:2025-07-10 09:05:13 瀏覽:294
andftp埠 發布:2025-07-10 08:57:04 瀏覽:607