1、数据库大作业 课题名称 专 业 班 级 学 号 姓 名 教 师 成 绩 11月 日1. 需求分析( 加入需求分析的概念) 描述题目内容1.1 数据流图( DFD) 什么是数据流图。 画数据流图图1-1 XXXX图1.2 数据字典( DD) 什么是数据字典写数据字典数据文件: 订单明细表文件组成: 订单序号Id, 订单编号, 菜名, 价格, 数量, 下单时间数 据 项: 订单序号Id数据类型: 整型数据长度: 4数 据 项: 订单编号数据类型: 可变字符类型数据长度: 50数据组成: A+日期时间数 据 项: 菜名数据类型: 可变字符类型数据长度: 502. 概念结构设计什么概念结构设计E-R图
2、( 在Powerdesigner中创立概念模型, 粘贴图) 图2-1 XXXX图3. 逻辑结构设计关系模式( ( 在Powerdesigner中由概念模型转化为物理数据模型, 粘图) ) 图3-1 XXXX图4. 建表SQL语句由物理数据模型生成SQL Server 数据库的建表语句。/*=*/* DBMS name: Microsoft SQL Server */* Created on: -9-16 14:39:14 */*=*/if exists (select 1 from sys.sysreferences r join sys.sysobjects o on (o.id = r.c
3、onstid and o.type = F) where r.fkeyid = object_id(SC) and o.name = FK_SC_SC_S)alter table SC drop constraint FK_SC_SC_Sgoif 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(SC) and o.name = FK_SC_SC2_C)alter table SC drop
4、 constraint FK_SC_SC2_Cgoif 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(TC) and o.name = FK_TC_TC_T)alter table TC drop constraint FK_TC_TC_Tgoif exists (select 1 from sys.sysreferences r join sys.sysobjects o on (o.
5、id = r.constid and o.type = F) where r.fkeyid = object_id(TC) and o.name = FK_TC_TC2_C)alter table TC drop constraint FK_TC_TC2_Cgoif exists (select 1 from sysobjects where id = object_id(C) and type = U) drop table Cgoif exists (select 1 from sysobjects where id = object_id(S) and type = U) drop ta
6、ble Sgoif exists (select 1 from sysindexes where id = object_id(SC) and name = SC2_FK and indid 0 and indid 0 and indid 0 and indid 0 and indid 255) drop index TC.TC_FKgoif exists (select 1 from sysobjects where id = object_id(TC) and type = U) drop table TCgo/*=*/* Table: C */*=*/create table C ( C
7、No char(2) not null, CN varchar(40) null, CT smallint null, constraint PK_C primary key nonclustered (CNo)go/*=*/* Table: S */*=*/create table S ( SNo char(2) not null, SN varchar(40) null, Gen char(2) null, Birth datetime null, Dept varchar(40) null, constraint PK_S primary key nonclustered (SNo)go
8、/*=*/* Table: SC */*=*/create table SC ( SNo char(2) not null, CNo char(2) not null, Score smallint null, constraint PK_SC primary key (SNo, CNo)go/*=*/* Index: SC_FK */*=*/create index SC_FK on SC (SNo ASC)go/*=*/* Index: SC2_FK */*=*/create index SC2_FK on SC (CNo ASC)go/*=*/* Table: T */*=*/creat
9、e table T ( TNo char(2) not null, TN varchar(40) null, Gen char(2) null, Birth datetime null, Prof varchar(40) null, Sal int null, Comm int null, Dept varchar(40) null, constraint PK_T primary key nonclustered (TNo)go/*=*/* Table: TC */*=*/create table TC ( TNo char(2) not null, CNo char(2) not null
10、, constraint PK_TC primary key (TNo, CNo)go/*=*/* Index: TC_FK */*=*/create index TC_FK on TC (TNo ASC)go/*=*/* Index: TC2_FK */*=*/create index TC2_FK on TC (CNo ASC)goalter table SC add constraint FK_SC_SC_S foreign key (SNo) references S (SNo)goalter table SC add constraint FK_SC_SC2_C foreign key (CNo) references C (CNo)goalter table TC add constraint FK_TC_TC_T foreign key (TNo) references T (TNo)goalter table TC add constraint FK_TC_TC2_C foreign key (CNo) references C (CNo)go5. 结论心得体会( 如果有相同的, 则都不及格) 参考教材: 数据库实验指导 主编: 杨海霞 出版社: 人民邮电出版社 书号: 978-115-16535-0