⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crebas.sql

📁 数据库原理的课程设计是关于展览场馆的分配和展位的分配
💻 SQL
字号:
/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2000                    */
/* Created on:     2008-6-14 16:29:58                           */
/*==============================================================*/


alter table 个人参观表
   drop constraint FK_个人参观表_REFERENCE_展会信息
go

alter table 个人参观表
   drop constraint FK_个人参观表_REFERENCE_人员信息
go

alter table 人员信息
   drop constraint FK_人员信息_REFERENCE_单位信息
go

alter table 单位活动表
   drop constraint FK_单位活动表_REFERENCE_人员信息
go

alter table 单位活动表
   drop constraint FK_单位活动表_REFERENCE_参展单位表
go

alter table 参展单位表
   drop constraint FK_参展单位表_REFERENCE_展会信息
go

alter table 参展单位表
   drop constraint FK_参展单位表_REFERENCE_单位信息
go

alter table 展会信息
   drop constraint FK_展会信息_REFERENCE_展区信息
go

alter table 收费单
   drop constraint FK_收费单_REFERENCE_展会信息
go

alter table 收费单
   drop constraint FK_收费单_REFERENCE_单位信息
go

alter table 收费单
   drop constraint FK_收费单_REFERENCE_活动表
go

alter table 活动表
   drop constraint FK_活动表_REFERENCE_单位活动表
go

alter table 邀请信息
   drop constraint FK_邀请信息_REFERENCE_展会信息
go

alter table 邀请信息
   drop constraint FK_邀请信息_REFERENCE_单位信息
go

alter table 邀请信息
   drop constraint FK_邀请信息_REFERENCE_人员信息
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  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  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  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  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

/*==============================================================*/
/* Table: 个人参观表                                                 */
/*==============================================================*/
create table 个人参观表 (
   人员编号                 int                  null,
   展会编号                 int                  null,
   价格                   money                null,
   参观编号                 int                  not null,
   constraint PK_个人参观表 primary key  (参观编号)
)
go

/*==============================================================*/
/* Table: 人员信息                                                  */
/*==============================================================*/
create table 人员信息 (
   人员编号                 int                  not null,
   单位编号                 int                  null,
   人员姓名                 varchar(10)          null,
   职务                   varchar(20)          null,
   负责业务                 varchar(20)          null,
   constraint PK_人员信息 primary key  (人员编号)
)
go

/*==============================================================*/
/* Table: 单位信息                                                  */
/*==============================================================*/
create table 单位信息 (
   单位编号                 int                  not null,
   单位名称                 varchar(10)          null,
   地址                   varchar(20)          null,
   联系电话                 varchar(10)          null,
   注册资金                 money                null,
   constraint PK_单位信息 primary key  (单位编号)
)
go

/*==============================================================*/
/* Table: 单位活动表                                                 */
/*==============================================================*/
create table 单位活动表 (
   单位活动编号               int                  not null,
   人员编号                 int                  null,
   参展单位编号               int                  null,
   确认时间                 timestamp            null,
   constraint PK_单位活动表 primary key  (单位活动编号)
)
go

/*==============================================================*/
/* Table: 参展单位表                                                 */
/*==============================================================*/
create table 参展单位表 (
   参展单位编号               int                  not null,
   展会编号                 int                  null,
   单位编号                 int                  null,
   constraint PK_参展单位表 primary key  (参展单位编号)
)
go

/*==============================================================*/
/* Table: 展会信息                                                  */
/*==============================================================*/
create table 展会信息 (
   展会编号                 int                  not null,
   展会名称                 varchar(10)          null,
   展区编号                 int                  null,
   时间                   timestamp            null,
   地点                   varchar(20)          null,
   室内单位租金               money                null,
   constraint PK_展会信息 primary key  (展会编号)
)
go

/*==============================================================*/
/* Table: 展区信息                                                  */
/*==============================================================*/
create table 展区信息 (
   展区编号                 int                  not null,
   展区名称                 varchar(10)          null,
   地址                   varchar(20)          null,
   联系电话                 char(11)             null,
   面积                   float                null,
   constraint PK_展区信息 primary key  (展区编号)
)
go

/*==============================================================*/
/* Table: 收费单                                                   */
/*==============================================================*/
create table 收费单 (
   收费编号                 int                  not null,
   展会编号                 int                  null,
   单位编号                 int                  null,
   活动编号                 int                  null,
   收费金额                 money                null,
   constraint PK_收费单 primary key  (收费编号)
)
go

/*==============================================================*/
/* Table: 活动表                                                   */
/*==============================================================*/
create table 活动表 (
   活动编号                 int                  not null,
   单位活动编号               int                  null,
   数量                   int                  null,
   金额                   money                null,
   constraint PK_活动表 primary key  (活动编号)
)
go

/*==============================================================*/
/* Table: 邀请信息                                                  */
/*==============================================================*/
create table 邀请信息 (
   邀请函编号                int                  not null,
   单位编号                 int                  null,
   人员编号                 int                  null,
   展会编号                 int                  null,
   发函日期                 datetime             null,
   回函时间                 datetime             null,
   constraint PK_邀请信息 primary key  (邀请函编号)
)
go

alter table 个人参观表
   add constraint FK_个人参观表_REFERENCE_展会信息 foreign key (展会编号)
      references 展会信息 (展会编号)
go

alter table 个人参观表
   add constraint FK_个人参观表_REFERENCE_人员信息 foreign key (人员编号)
      references 人员信息 (人员编号)
go

alter table 人员信息
   add constraint FK_人员信息_REFERENCE_单位信息 foreign key (单位编号)
      references 单位信息 (单位编号)
go

alter table 单位活动表
   add constraint FK_单位活动表_REFERENCE_人员信息 foreign key (人员编号)
      references 人员信息 (人员编号)
go

alter table 单位活动表
   add constraint FK_单位活动表_REFERENCE_参展单位表 foreign key (参展单位编号)
      references 参展单位表 (参展单位编号)
go

alter table 参展单位表
   add constraint FK_参展单位表_REFERENCE_展会信息 foreign key (展会编号)
      references 展会信息 (展会编号)
go

alter table 参展单位表
   add constraint FK_参展单位表_REFERENCE_单位信息 foreign key (单位编号)
      references 单位信息 (单位编号)
go

alter table 展会信息
   add constraint FK_展会信息_REFERENCE_展区信息 foreign key (展区编号)
      references 展区信息 (展区编号)
go

alter table 收费单
   add constraint FK_收费单_REFERENCE_展会信息 foreign key (展会编号)
      references 展会信息 (展会编号)
go

alter table 收费单
   add constraint FK_收费单_REFERENCE_单位信息 foreign key (单位编号)
      references 单位信息 (单位编号)
go

alter table 收费单
   add constraint FK_收费单_REFERENCE_活动表 foreign key (活动编号)
      references 活动表 (活动编号)
go

alter table 活动表
   add constraint FK_活动表_REFERENCE_单位活动表 foreign key (单位活动编号)
      references 单位活动表 (单位活动编号)
go

alter table 邀请信息
   add constraint FK_邀请信息_REFERENCE_展会信息 foreign key (展会编号)
      references 展会信息 (展会编号)
go

alter table 邀请信息
   add constraint FK_邀请信息_REFERENCE_单位信息 foreign key (单位编号)
      references 单位信息 (单位编号)
go

alter table 邀请信息
   add constraint FK_邀请信息_REFERENCE_人员信息 foreign key (人员编号)
      references 人员信息 (人员编号)
go

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -