云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 实验七 PowerDesigner数据库设计

实验七 PowerDesigner数据库设计

  • 62 次阅读
  • 3 次下载
  • 2026/1/11 16:40:08

图7-5

同样图7-5中也不是本实验要去建立的完整的物理模型,请在完成完整的概念模型后,再生成物理模型,并完善联系自身的属性。结果保存成.PDM的文件。

3. 生成数据库表

选择菜单“Database”下“Generate Database”,选定脚本文件的保存位置,如桌面,点击“确定”按钮,生成建立该数据库表的.sql脚本文件。如图7-6所示。

图7-6

查看脚本文件的内容,可在SQL Server2005中打开该脚本并运行,即生成所有的数据库表。

/*==============================================================*/ /* DBMS name: Microsoft SQL Server 2005 */ /* Created on: 2015/6/24 8:45:57 */

/*==============================================================*/

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F') where r.fkeyid = object_id('选课') and o.name = 'FK_选课_选课_学生') alter table 选课

drop constraint FK_选课_选课_学生 go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F') where r.fkeyid = object_id('选课') and o.name = 'FK_选课_选课2_课程') alter table 选课

drop constraint FK_选课_选课2_课程 go

if exists (select 1

from sysobjects

where id = object_id('学生') and type = 'U') drop table 学生 go

if exists (select 1

from sysobjects

where id = object_id('课程') and type = 'U') drop table 课程 go

if exists (select 1

from sysindexes

where id = object_id('选课') and name = '选课2_FK' and indid > 0 and indid < 255) drop index 选课.选课2_FK go

if exists (select 1

from sysindexes

where id = object_id('选课') and name = '选课_FK' and indid > 0 and indid < 255) drop index 选课.选课_FK go

if exists (select 1

from sysobjects

where id = object_id('选课') and type = 'U') drop table 选课 go

/*==============================================================*/ /* Table: 学生 */ /*==============================================================*/ create table 学生 (

学号 char(8) not null, 姓名 varchar(10) not null, 性别 char(2) null, constraint PK_学生 primary key nonclustered (学号) ) go

/*==============================================================*/ /* Table: 课程 */ /*==============================================================*/ create table 课程 (

课程号 char(8) not null, 课程名 varchar(20) not null, 学分 numeric(4,2) null, constraint PK_课程 primary key nonclustered (课程号) ) go

/*==============================================================*/ /* Table: 选课 */ /*==============================================================*/ create table 选课 (

学号 char(8) not null, 课程号 char(8) not null, 成绩 numeric(4,2) null, constraint PK_选课 primary key (学号, 课程号) ) go

/*==============================================================*/ /* Index: 选课_FK */ /*==============================================================*/ create index 选课_FK on 选课 ( 学号 ASC )

搜索更多关于: 实验七 PowerDesigner数据库设计 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

图7-5 同样图7-5中也不是本实验要去建立的完整的物理模型,请在完成完整的概念模型后,再生成物理模型,并完善联系自身的属性。结果保存成.PDM的文件。 3. 生成数据库表 选择菜单“Database”下“Generate Database”,选定脚本文件的保存位置,如桌面,点击“确定”按钮,生成建立该数据库表的.sql脚本文件。如图7-6所示。 图7-6 查看脚本文件的内容,可在SQL Server2005中打开该脚本并运行,即生成所有的数据库表。 /*==============================================================*/ /* DBMS name

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com