4.数据库逻辑数据模型设计
此处根据数据库概念数据模型和数据库概念模型向关系数据库模型转换的规则,生成出系统的数据库逻辑数据模型。
5. 数据库物理数据模型设计
此处根据数据库概念数据模型生成数据库物理数据模型后,截图粘贴到此处。
6.建立数据库的SQL代码
if exists(select 1 from sys.sysforeignkey where role='FK_ENTITY_6_RELATIONS_客户') then
alter table Entity_6
delete foreign key FK_ENTITY_6_RELATIONS_客户 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客户_RELATIONS_客房') then alter table 客户
delete foreign key FK_客户_RELATIONS_客房 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客户_RELATIONS_ENTITY_8')
then
alter table 客户
delete foreign key FK_客户_RELATIONS_ENTITY_8 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客户_RELATIONS_ENTITY_9') then
alter table 客户
delete foreign key FK_客户_RELATIONS_ENTITY_9 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客户住宿_RELATIONS_客房') then
alter table 客户住宿
delete foreign key FK_客户住宿_RELATIONS_客房 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客房_RELATIONS_前台') then alter table 客房
delete foreign key FK_客房_RELATIONS_前台 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客房_RELATIONS_ENTITY_7') then
alter table 客房
delete foreign key FK_客房_RELATIONS_ENTITY_7 end if;
if exists(select 1 from sys.sysforeignkey where role='FK_客房_RELATIONS_ENTITY_1') then
alter table 客房
delete foreign key FK_客房_RELATIONS_ENTITY_1 end if;
drop index if exists Entity_10.Entity_10_PK;
drop table if exists Entity_10;
drop index if exists Entity_6.Relationship_7_FK;
drop index if exists Entity_6.Entity_6_PK;
drop table if exists Entity_6;
drop index if exists Entity_7.Entity_7_PK;
drop table if exists Entity_7;
drop index if exists Entity_8.Entity_8_PK;
drop table if exists Entity_8;
drop index if exists Entity_9.Entity_9_PK;
drop table if exists Entity_9;
drop index if exists 前台.前台_PK;
drop table if exists 前台;
drop index if exists 客户.Relationship_5_FK;
drop index if exists 客户.Relationship_4_FK;
drop index if exists 客户.Relationship_3_FK;
drop index if exists 客户.客户_PK;
drop table if exists 客户;
drop index if exists 客户住宿.Relationship_6_FK;
drop index if exists 客户住宿.客户住宿_PK;
drop table if exists 客户住宿;
drop index if exists 客房.Relationship_8_FK;
drop index if exists 客房.Relationship_2_FK;
drop index if exists 客房.Relationship_1_FK;
drop index if exists 客房.客房_PK;
drop table if exists 客房;
/*==============================================================*/ /* Table: Entity_10 */ /*==============================================================*/ create table Entity_10 (
Attribute_34 char(10) not null, Attribute_35 char(10) null,