create table 客户住宿 (
Attribute_17 char(10) not null, Attribute_18 char(10) not null, 客房号 char(10) null, 入住时间 char(10) null, 住宿时间 char(10) null, 退房时间 char(10) null, 消费费用 char(10) null, constraint PK_客户住宿 primary key (Attribute_17, Attribute_18) );
/*==============================================================*/ /* Index: 客户住宿_PK */ /*==============================================================*/ create unique index 客户住宿_PK on 客户住宿 ( Attribute_17 ASC, Attribute_18 ASC );
/*==============================================================*/ /* Index: Relationship_6_FK */ /*==============================================================*/ create index Relationship_6_FK on 客户住宿 ( 客房号 ASC );
/*==============================================================*/ /* Table: 客房 */ /*==============================================================*/ create table 客房
(
客房号 char(10) not null, Attribute_26 char(10) null, 编号 char(10) null, Attribute_34 char(10) not null, 客房类型 char(10) null, 客房状态 char(10) null, 价格 char(10) null, constraint PK_客房 primary key (客房号) );
/*==============================================================*/ /* Index: 客房_PK */ /*==============================================================*/ create unique index 客房_PK on 客房 ( 客房号 ASC );
/*==============================================================*/ /* Index: Relationship_1_FK */ /*==============================================================*/ create index Relationship_1_FK on 客房 ( 编号 ASC );
/*==============================================================*/ /* Index: Relationship_2_FK */ /*==============================================================*/ create index Relationship_2_FK on 客房 ( Attribute_26 ASC );
/*==============================================================*/ /* Index: Relationship_8_FK */ /*==============================================================*/ create index Relationship_8_FK on 客房 ( Attribute_34 ASC );
alter table Entity_6
add constraint FK_ENTITY_6_RELATIONS_客户 foreign key (身份证号) references 客户 (身份证号) on update restrict on delete restrict;
alter table 客户
add constraint FK_客户_RELATIONS_客房 foreign key (客房号) references 客房 (客房号) on update restrict on delete restrict;
alter table 客户
add constraint FK_客户_RELATIONS_ENTITY_8 foreign key (Attribute_29) references Entity_8 (Attribute_29) on update restrict on delete restrict;
alter table 客户
add constraint FK_客户_RELATIONS_ENTITY_9 foreign key (Attribute_32) references Entity_9 (Attribute_32) on update restrict on delete restrict;
alter table 客户住宿
add constraint FK_客户住宿_RELATIONS_客房 foreign key (客房号) references 客房 (客房号) on update restrict on delete restrict;
alter table 客房
add constraint FK_客房_RELATIONS_前台 foreign key (编号) references 前台 (编号) on update restrict on delete restrict;
alter table 客房
add constraint FK_客房_RELATIONS_ENTITY_7 foreign key (Attribute_26) references Entity_7 (Attribute_26) on update restrict on delete restrict;
alter table 客房
add constraint FK_客房_RELATIONS_ENTITY_1 foreign key (Attribute_34) references Entity_10 (Attribute_34) on update restrict on delete restrict;