?? crebas.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 + -