/*==============================================================*/
/* DBMS name: Sybase SQL Anywhere 12 */
/* Created on: 2018-6-6 10:20:36 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_BAOHAN_BAOHAN_SHOP') then
alter table baohan
delete foreign key FK_BAOHAN_BAOHAN_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BAOHAN_BAOHAN2_CKTABLE') then
alter table baohan
delete foreign key FK_BAOHAN_BAOHAN2_CKTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BH_BH_SHOP') then
alter table bh
delete foreign key FK_BH_BH_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BH_BH2_RKTABLE') then
alter table bh
delete foreign key FK_BH_BH2_RKTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BSTABLE_BAOSUN_STORAGE') then
alter table bstable
delete foreign key FK_BSTABLE_BAOSUN_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BUY_BUY_SHOP') then
alter table buy
delete foreign key FK_BUY_BUY_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BUY_BUY2_KEHU') then
alter table buy
delete foreign key FK_BUY_BUY2_KEHU
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BYTABLE_BAOYI_STORAGE') then
alter table bytable
delete foreign key FK_BYTABLE_BAOYI_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CKTABLE_CHUKU_STORAGE') then
alter table cktable
delete foreign key FK_CKTABLE_CHUKU_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CKTABLE_SHENQING_KEHU') then
alter table cktable
delete foreign key FK_CKTABLE_SHENQING_KEHU
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTA_CONTA_SHOP') then
alter table conta
delete foreign key FK_CONTA_CONTA_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTA_CONTA2_BSTABLE') then
alter table conta
delete foreign key FK_CONTA_CONTA2_BSTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTAIN_CONTAIN_SHOP') then
alter table contain
delete foreign key FK_CONTAIN_CONTAIN_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTAIN_CONTAIN2_PDTABLE') then
alter table contain
delete foreign key FK_CONTAIN_CONTAIN2_PDTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CZY_YONGYOU_USER') then
alter table czy
delete foreign key FK_CZY_YONGYOU_USER
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DIOBO_DIOBO_STORAGE') then
alter table diobo
delete foreign key FK_DIOBO_DIOBO_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DIOBO_DIOBO2_DBTABLE') then
alter table diobo
delete foreign key FK_DIOBO_DIOBO2_DBTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DQKC_DQKC_STORAGE') then
alter table dqkc
delete foreign key FK_DQKC_DQKC_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DQKC_DQKC2_SHOP') then
alter table dqkc
delete foreign key FK_DQKC_DQKC2_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLU_INCLU_SHOP') then
alter table inclu
delete foreign key FK_INCLU_INCLU_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLU_INCLU2_DBTABLE') then
alter table inclu
delete foreign key FK_INCLU_INCLU2_DBTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLUDE_INCLUDE_BYTABLE') then
alter table include
delete foreign key FK_INCLUDE_INCLUDE_BYTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLUDE_INCLUDE2_SHOP') then
alter table include
delete foreign key FK_INCLUDE_INCLUDE2_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_PDTABLE_PANDIAN_STORAGE') then
alter table pdtable
delete foreign key FK_PDTABLE_PANDIAN_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RKTABLE_RUKU_STORAGE') then
alter table rktable
delete foreign key FK_RKTABLE_RUKU_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_STORAGE_管理_CZY') then
alter table storage
delete foreign key FK_STORAGE_管理_CZY
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SUPPLY_SUPPLY_GYS') then
alter table supply
delete foreign key FK_SUPPLY_SUPPLY_GYS
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SUPPLY_SUPPLY2_SHOP') then
alter table supply
delete foreign key FK_SUPPLY_SUPPLY2_SHOP
end if;
drop index if exists baohan.baohan2_FK;
drop index if exists baohan.baohan_FK;
drop index if exists baohan.baohan_PK;
drop table if exists baohan;
drop index if exists bh.bh2_FK;
drop index if exists bh.bh_FK;
drop index if exists bh.bh_PK;
drop table if exists bh;
drop index if exists bstable.baosun_FK;
drop index if exists bstable.bstable_PK;
drop table if exists bstable;
drop index if exists buy.buy2_FK;
drop index if exists buy.buy_FK;
drop index if exists buy.buy_PK;
drop table if exists buy;
drop index if exists bytable.baoyi_FK;
drop index if exists bytable.bytable_PK;
drop table if exists bytable;
drop index if exists cktable.shenqing_FK;
drop index if exists cktable.chuku_FK;
drop index if exists cktable.cktable_PK;
drop table if exists cktable;
drop index if exists conta.conta2_FK;
drop index if exists conta.conta_FK;
drop index if exists conta.conta_PK;
drop table if exists conta;
drop index if exists contain.contain2_FK;
drop index if exists contain.contain_FK;
drop index if exists contain.contain_PK;
drop table if exists contain;
drop index if exists czy.yongyou_FK;
drop index if exists czy.czy_PK;
drop table if exists czy;
drop index if exists dbtable.dbtable_PK;
drop table if exists dbtable;
drop index if exists diobo.diobo2_FK;
drop index if exists diobo.diobo_FK;
drop index if exists diobo.diobo_PK;
drop table if exists diobo;
drop index if exists dqkc.dqkc2_FK;
drop index if exists dqkc.dqkc_FK;
drop index if exists dqkc.dqkc_PK;
drop table if exists dqkc;
drop index if exists gys.gys_PK;
drop table if exists gys;
drop index if exists inclu.inclu2_FK;
drop index if exists inclu.inclu_FK;
drop index if exists inclu.inclu_PK;
drop table if exists inclu;
drop index if exists include.include2_FK;
drop index if exists include.include_FK;
drop index if exists include.include_PK;
drop table if exists include;
drop index if exists kehu.kehu_PK;
drop table if exists kehu;
drop index if exists pdtable.pandian_FK;
drop index if exists pdtable.pdtable_PK;
drop table if exists pdtable;
drop index if exists rktable.ruku_FK;
drop index if exists rktable.rktable_PK;
drop table if exists rktable;
drop index if exists shop.shop_PK;
drop table if exists shop;
drop index if exists storage.管理_FK;
drop index if exists storage.storage_PK;
drop table if exists storage;
drop index if exists supply.supply2_FK;
drop index if exists supply.supply_FK;
drop index if exists supply.supply_PK;
drop table if exists supply;
drop index if exists "user".user_PK;
drop table if exists "user";
/*==============================================================*/
/* Table: baohan */
/*==============================================================*/
create table baohan
(
sid integer not null,
ckid integer not null,
constraint PK_BAOHAN primary key clustered (sid, ckid)
);
/*==============================================================*/
/* Index: baohan_PK */
/*==============================================================*/
create unique clustered index baohan_PK on baohan (
sid ASC,
ckid ASC
);
/*==============================================================*/
/* Index: baohan_FK */
/*==============================================================*/
create index baohan_FK on baohan (
sid ASC
);
/*==============================================================*/
/* Index: baohan2_FK */
/*==============================================================*/
create index baohan2_FK on baohan (
ckid ASC
);
/*==============================================================*/
/* Table: bh */
/*==============================================================*/
create table bh
(
sid integer not null,
rid integer not null,
constraint PK_BH primary key clustered (sid, rid)
);
/*==============================================================*/
/* Index: bh_PK */
/*==============================================================*/
create unique clustered index bh_PK on bh (
sid ASC,
rid ASC
);
/*==============================================================*/
/* Index: bh_FK */
/*==============================================================*/
create index bh_FK on bh (
sid ASC
);
/*==============================================================*/
/* Index: bh2_FK */
/*==============================================================*/
create index bh2_FK on bh (
rid ASC
);
/*==============================================================*/
/* Table: bstable */
/*==============================================================*/
create table bstable
(
lid integer not null,
wid integer null,
ldate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
lqty integer not null,
ltp float not null,
tlqty integer not null,
note varchar(20) null,
constraint PK_BSTABLE primary key (lid)
);
/*==============================================================*/
/* Index: bstable_PK */
/*==============================================================*/
create unique index bstable_PK on bstable (
lid ASC
);
/*==============================================================*/
/* Index: baosun_FK */
/*==============================================================*/
create index baosun_FK on bstable (
wid ASC
);
/*==============================================================*/
/* Table: buy */
/*==============================================================*/
create table buy
(
sid integer not null,
cid integer not null,
constraint PK_BUY primary key clustered (sid, cid)
);
/*==============================================================*/
/* Index: buy_PK */
/*==============================================================*/
create unique clustered index buy_PK on buy (
sid ASC,
cid ASC
);
/*==============================================================*/
/* Index: buy_FK */
/*==============================================================*/
create index buy_FK on buy (
sid ASC
);
/*==============================================================*/
/* Index: buy2_FK */
/*==============================================================*/
create index buy2_FK on buy (
cid ASC
);
/*==============================================================*/
/* Table: bytable */
/*==============================================================*/
create table bytable
(
fid integer not null,
wid integer null,
fdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rup float not null,
fqty integer not null,
ftp float not null,
tfqty integer not null,
note varchar(20) null,
constraint PK_BYTABLE primary key (fid)
);
/*==============================================================*/
/* Index: bytable_PK */
/*==============================================================*/
create unique index bytable_PK on bytable (
fid ASC
);
/*==============================================================*/
/* Index: baoyi_FK */
/*==============================================================*/
create index baoyi_FK on bytable (
wid ASC
);
/*==============================================================*/
/* Table: cktable */
/*==============================================================*/
create table cktable
(
ckid integer not null,
cid integer null,
wid integer null,
ckdate timestamp null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
cup float not null,
cqty integer not null,
ctp float not null,
tckqty integer null,
note varchar(20) null,
constraint PK_CKTABLE primary key (ckid)
);
/*==============================================================*/
/* Index: cktable_PK */
/*==============================================================*/
create unique index cktable_PK on cktable (
ckid ASC
);
/*==============================================================*/
/* Index: chuku_FK */
/*==============================================================*/
create index chuku_FK on cktable (
wid ASC
);
/*==============================================================*/
/* Index: shenqing_FK */
/*==============================================================*/
create index shenqing_FK on cktable (
cid ASC
);
/*==============================================================*/
/* Table: conta */
/*==============================================================*/
create table conta
(
sid integer not null,
lid integer not null,
constraint PK_CONTA primary key clustered (sid, lid)
);
/*==============================================================*/
/* Index: conta_PK */
/*==============================================================*/
create unique clustered index conta_PK on conta (
sid ASC,
lid ASC
);
/*==============================================================*/
/* Index: conta_FK */
/*==============================================================*/
create index conta_FK on conta (
sid ASC
);
/*==============================================================*/
/* Index: conta2_FK */
/*==============================================================*/
create index conta2_FK on conta (
lid ASC
);
/*==============================================================*/
/* Table: contain */
/*==============================================================*/
create table contain
(
sid integer not null,
pid char(10) not null,
constraint PK_CONTAIN primary key clustered (sid, pid)
);
/*==============================================================*/
/* Index: contain_PK */
/*==============================================================*/
create unique clustered index contain_PK on contain (
sid ASC,
pid ASC
);
/*==============================================================*/
/* Index: contain_FK */
/*==============================================================*/
create index contain_FK on contain (
sid ASC
);
/*==============================================================*/
/* Index: contain2_FK */
/*==============================================================*/
create index contain2_FK on contain (
pid ASC
);
/*==============================================================*/
/* Table: czy */
/*==============================================================*/
create table czy
(
eno integer not null,
uname char(10) null,
password char(20) null,
ename char(8) not null,
sex char(2) null,
dename char(20) null,
tel char(11) null,
"add" char(20) null,
state char(2) null,
constraint PK_CZY primary key (eno)
);
/*==============================================================*/
/* Index: czy_PK */
/*==============================================================*/
create unique index czy_PK on czy (
eno ASC
);
/*==============================================================*/
/* Index: yongyou_FK */
/*==============================================================*/
create index yongyou_FK on czy (
uname ASC,
password ASC
);
/*==============================================================*/
/* Table: dbtable */
/*==============================================================*/
create table dbtable
(
tid integer not null,
tdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
dbqty integer not null,
ttp float not null,
tdbqty integer not null,
note varchar(20) null,
constraint PK_DBTABLE primary key (tid)
);
/*==============================================================*/
/* Index: dbtable_PK */
/*==============================================================*/
create unique index dbtable_PK on dbtable (
tid ASC
);
/*==============================================================*/
/* Table: diobo */
/*==============================================================*/
create table diobo
(
wid integer not null,
tid integer not null,
constraint PK_DIOBO primary key clustered (wid, tid)
);
/*==============================================================*/
/* Index: diobo_PK */
/*==============================================================*/
create unique clustered index diobo_PK on diobo (
wid ASC,
tid ASC
);
/*==============================================================*/
/* Index: diobo_FK */
/*==============================================================*/
create index diobo_FK on diobo (
wid ASC
);
/*==============================================================*/
/* Index: diobo2_FK */
/*==============================================================*/
create index diobo2_FK on diobo (
tid ASC
);
/*==============================================================*/
/* Table: dqkc */
/*==============================================================*/
create table dqkc
(
wid integer not null,
sid integer not null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
inqty varchar(10) not null,
tkp float not null,
twqty integer not null,
note varchar(20) null,
constraint PK_DQKC primary key clustered (wid, sid)
);
/*==============================================================*/
/* Index: dqkc_PK */
/*==============================================================*/
create unique clustered index dqkc_PK on dqkc (
wid ASC,
sid ASC
);
/*==============================================================*/
/* Index: dqkc_FK */
/*==============================================================*/
create index dqkc_FK on dqkc (
wid ASC
);
/*==============================================================*/
/* Index: dqkc2_FK */
/*==============================================================*/
create index dqkc2_FK on dqkc (
sid ASC
);
/*==============================================================*/
/* Table: gys */
/*==============================================================*/
create table gys
(
gid integer not null,
gname char(8) not null,
company char(20) null,
tel char(11) null,
mail varchar(20) null,
gadd varchar(20) null,
ghzt char(2) null,
note varchar(20) null,
constraint PK_GYS primary key (gid)
);
/*==============================================================*/
/* Index: gys_PK */
/*==============================================================*/
create unique index gys_PK on gys (
gid ASC
);
/*==============================================================*/
/* Table: inclu */
/*==============================================================*/
create table inclu
(
sid integer not null,
tid integer not null,
constraint PK_INCLU primary key clustered (sid, tid)
);
/*==============================================================*/
/* Index: inclu_PK */
/*==============================================================*/
create unique clustered index inclu_PK on inclu (
sid ASC,
tid ASC
);
/*==============================================================*/
/* Index: inclu_FK */
/*==============================================================*/
create index inclu_FK on inclu (
sid ASC
);
/*==============================================================*/
/* Index: inclu2_FK */
/*==============================================================*/
create index inclu2_FK on inclu (
tid ASC
);
/*==============================================================*/
/* Table: include */
/*==============================================================*/
create table include
(
fid integer not null,
sid integer not null,
constraint PK_INCLUDE primary key clustered (fid, sid)
);
/*==============================================================*/
/* Index: include_PK */
/*==============================================================*/
create unique clustered index include_PK on include (
fid ASC,
sid ASC
);
/*==============================================================*/
/* Index: include_FK */
/*==============================================================*/
create index include_FK on include (
fid ASC
);
/*==============================================================*/
/* Index: include2_FK */
/*==============================================================*/
create index include2_FK on include (
sid ASC
);
/*==============================================================*/
/* Table: kehu */
/*==============================================================*/
create table kehu
(
cid integer not null,
cname char(8) not null,
comp char(20) null,
tel char(11) null,
mail varchar(20) null,
cadd varchar(20) null,
stbuy char(1) null,
note varchar(20) null,
constraint PK_KEHU primary key (cid)
);
/*==============================================================*/
/* Index: kehu_PK */
/*==============================================================*/
create unique index kehu_PK on kehu (
cid ASC
);
/*==============================================================*/
/* Table: pdtable */
/*==============================================================*/
create table pdtable
(
pid char(10) not null,
wid integer null,
pdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
inqty varchar(10) not null,
tkp float not null,
twqty integer null,
pdup float not null,
pdqty integer not null,
tpbp float not null,
tpdqty integer not null,
note varchar(20) null,
constraint PK_PDTABLE primary key (pid)
);
/*==============================================================*/
/* Index: pdtable_PK */
/*==============================================================*/
create unique index pdtable_PK on pdtable (
pid ASC
);
/*==============================================================*/
/* Index: pandian_FK */
/*==============================================================*/
create index pandian_FK on pdtable (
wid ASC
);
/*==============================================================*/
/* Table: rktable */
/*==============================================================*/
create table rktable
(
rid integer not null,
wid integer null,
rdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
rqty integer not null,
rtp float not null,
trqty integer not null,
note varchar(20) null,
constraint PK_RKTABLE primary key (rid)
);
/*==============================================================*/
/* Index: rktable_PK */
/*==============================================================*/
create unique index rktable_PK on rktable (
rid ASC
);
/*==============================================================*/
/* Index: ruku_FK */
/*==============================================================*/
create index ruku_FK on rktable (
wid ASC
);
/*==============================================================*/
/* Table: shop */
/*==============================================================*/
create table shop
(
sid integer not null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
kcxx integer null,
kcsx integer null,
"stop" char(1) null,
note varchar(20) null,
constraint PK_SHOP primary key (sid)
);
/*==============================================================*/
/* Index: shop_PK */
/*==============================================================*/
create unique index shop_PK on shop (
sid ASC
);
/*==============================================================*/
/* Table: storage */
/*==============================================================*/
create table storage
(
wid integer not null,
eno integer null,
wname char(20) not null,
wdd varchar(20) null,
area char(10) null,
whead char(8) null,
wtel char(11) null,
ty char(1) null,
note varchar(20) null,
constraint PK_STORAGE primary key (wid)
);
/*==============================================================*/
/* Index: storage_PK */
/*==============================================================*/
create unique index storage_PK on storage (
wid ASC
);
/*==============================================================*/
/* Index: 管理_FK */
/*==============================================================*/
create index 管理_FK on storage (
eno ASC
);
/*==============================================================*/
/* Table: supply */
/*==============================================================*/
create table supply
(
gid integer not null,
sid integer not null,
constraint PK_SUPPLY primary key clustered (gid, sid)
);
/*==============================================================*/
/* Index: supply_PK */
/*==============================================================*/
create unique clustered index supply_PK on supply (
gid ASC,
sid ASC
);
/*==============================================================*/
/* Index: supply_FK */
/*==============================================================*/
create index supply_FK on supply (
gid ASC
);
/*==============================================================*/
/* Index: supply2_FK */
/*==============================================================*/
create index supply2_FK on supply (
sid ASC
);
/*==============================================================*/
/* Table: "user" */
/*==============================================================*/
create table "user"
(
uname char(10) not null,
password char(20) not null,
constraint PK_USER primary key (uname, password)
);
/*==============================================================*/
/* Index: user_PK */
/*==============================================================*/
create unique index user_PK on "user" (
uname ASC,
password ASC
);
alter table baohan
add constraint FK_BAOHAN_BAOHAN_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table baohan
add constraint FK_BAOHAN_BAOHAN2_CKTABLE foreign key (ckid)
references cktable (ckid)
on update restrict
on delete restrict;
alter table bh
add constraint FK_BH_BH_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table bh
add constraint FK_BH_BH2_RKTABLE foreign key (rid)
references rktable (rid)
on update restrict
on delete restrict;
alter table bstable
add constraint FK_BSTABLE_BAOSUN_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table buy
add constraint FK_BUY_BUY_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table buy
add constraint FK_BUY_BUY2_KEHU foreign key (cid)
references kehu (cid)
on update restrict
on delete restrict;
alter table bytable
add constraint FK_BYTABLE_BAOYI_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table cktable
add constraint FK_CKTABLE_CHUKU_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table cktable
add constraint FK_CKTABLE_SHENQING_KEHU foreign key (cid)
references kehu (cid)
on update restrict
on delete restrict;
alter table conta
add constraint FK_CONTA_CONTA_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table conta
add constraint FK_CONTA_CONTA2_BSTABLE foreign key (lid)
references bstable (lid)
on update restrict
on delete restrict;
alter table contain
add constraint FK_CONTAIN_CONTAIN_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table contain
add constraint FK_CONTAIN_CONTAIN2_PDTABLE foreign key (pid)
references pdtable (pid)
on update restrict
on delete restrict;
alter table czy
add constraint FK_CZY_YONGYOU_USER foreign key (uname, password)
references "user" (uname, password)
on update restrict
on delete restrict;
alter table diobo
add constraint FK_DIOBO_DIOBO_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table diobo
add constraint FK_DIOBO_DIOBO2_DBTABLE foreign key (tid)
references dbtable (tid)
on update restrict
on delete restrict;
alter table dqkc
add constraint FK_DQKC_DQKC_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table dqkc
add constraint FK_DQKC_DQKC2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table inclu
add constraint FK_INCLU_INCLU_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table inclu
add constraint FK_INCLU_INCLU2_DBTABLE foreign key (tid)
references dbtable (tid)
on update restrict
on delete restrict;
alter table include
add constraint FK_INCLUDE_INCLUDE_BYTABLE foreign key (fid)
references bytable (fid)
on update restrict
on delete restrict;
alter table include
add constraint FK_INCLUDE_INCLUDE2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table pdtable
add constraint FK_PDTABLE_PANDIAN_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table rktable
add constraint FK_RKTABLE_RUKU_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table storage
add constraint FK_STORAGE_管理_CZY foreign key (eno)
references czy (eno)
on update restrict
on delete restrict;
alter table supply
add constraint FK_SUPPLY_SUPPLY_GYS foreign key (gid)
references gys (gid)
on update restrict
on delete restrict;
alter table supply
add constraint FK_SUPPLY_SUPPLY2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
/* DBMS name: Sybase SQL Anywhere 12 */
/* Created on: 2018-6-6 10:20:36 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_BAOHAN_BAOHAN_SHOP') then
alter table baohan
delete foreign key FK_BAOHAN_BAOHAN_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BAOHAN_BAOHAN2_CKTABLE') then
alter table baohan
delete foreign key FK_BAOHAN_BAOHAN2_CKTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BH_BH_SHOP') then
alter table bh
delete foreign key FK_BH_BH_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BH_BH2_RKTABLE') then
alter table bh
delete foreign key FK_BH_BH2_RKTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BSTABLE_BAOSUN_STORAGE') then
alter table bstable
delete foreign key FK_BSTABLE_BAOSUN_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BUY_BUY_SHOP') then
alter table buy
delete foreign key FK_BUY_BUY_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BUY_BUY2_KEHU') then
alter table buy
delete foreign key FK_BUY_BUY2_KEHU
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_BYTABLE_BAOYI_STORAGE') then
alter table bytable
delete foreign key FK_BYTABLE_BAOYI_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CKTABLE_CHUKU_STORAGE') then
alter table cktable
delete foreign key FK_CKTABLE_CHUKU_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CKTABLE_SHENQING_KEHU') then
alter table cktable
delete foreign key FK_CKTABLE_SHENQING_KEHU
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTA_CONTA_SHOP') then
alter table conta
delete foreign key FK_CONTA_CONTA_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTA_CONTA2_BSTABLE') then
alter table conta
delete foreign key FK_CONTA_CONTA2_BSTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTAIN_CONTAIN_SHOP') then
alter table contain
delete foreign key FK_CONTAIN_CONTAIN_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CONTAIN_CONTAIN2_PDTABLE') then
alter table contain
delete foreign key FK_CONTAIN_CONTAIN2_PDTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_CZY_YONGYOU_USER') then
alter table czy
delete foreign key FK_CZY_YONGYOU_USER
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DIOBO_DIOBO_STORAGE') then
alter table diobo
delete foreign key FK_DIOBO_DIOBO_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DIOBO_DIOBO2_DBTABLE') then
alter table diobo
delete foreign key FK_DIOBO_DIOBO2_DBTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DQKC_DQKC_STORAGE') then
alter table dqkc
delete foreign key FK_DQKC_DQKC_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_DQKC_DQKC2_SHOP') then
alter table dqkc
delete foreign key FK_DQKC_DQKC2_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLU_INCLU_SHOP') then
alter table inclu
delete foreign key FK_INCLU_INCLU_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLU_INCLU2_DBTABLE') then
alter table inclu
delete foreign key FK_INCLU_INCLU2_DBTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLUDE_INCLUDE_BYTABLE') then
alter table include
delete foreign key FK_INCLUDE_INCLUDE_BYTABLE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_INCLUDE_INCLUDE2_SHOP') then
alter table include
delete foreign key FK_INCLUDE_INCLUDE2_SHOP
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_PDTABLE_PANDIAN_STORAGE') then
alter table pdtable
delete foreign key FK_PDTABLE_PANDIAN_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_RKTABLE_RUKU_STORAGE') then
alter table rktable
delete foreign key FK_RKTABLE_RUKU_STORAGE
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_STORAGE_管理_CZY') then
alter table storage
delete foreign key FK_STORAGE_管理_CZY
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SUPPLY_SUPPLY_GYS') then
alter table supply
delete foreign key FK_SUPPLY_SUPPLY_GYS
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_SUPPLY_SUPPLY2_SHOP') then
alter table supply
delete foreign key FK_SUPPLY_SUPPLY2_SHOP
end if;
drop index if exists baohan.baohan2_FK;
drop index if exists baohan.baohan_FK;
drop index if exists baohan.baohan_PK;
drop table if exists baohan;
drop index if exists bh.bh2_FK;
drop index if exists bh.bh_FK;
drop index if exists bh.bh_PK;
drop table if exists bh;
drop index if exists bstable.baosun_FK;
drop index if exists bstable.bstable_PK;
drop table if exists bstable;
drop index if exists buy.buy2_FK;
drop index if exists buy.buy_FK;
drop index if exists buy.buy_PK;
drop table if exists buy;
drop index if exists bytable.baoyi_FK;
drop index if exists bytable.bytable_PK;
drop table if exists bytable;
drop index if exists cktable.shenqing_FK;
drop index if exists cktable.chuku_FK;
drop index if exists cktable.cktable_PK;
drop table if exists cktable;
drop index if exists conta.conta2_FK;
drop index if exists conta.conta_FK;
drop index if exists conta.conta_PK;
drop table if exists conta;
drop index if exists contain.contain2_FK;
drop index if exists contain.contain_FK;
drop index if exists contain.contain_PK;
drop table if exists contain;
drop index if exists czy.yongyou_FK;
drop index if exists czy.czy_PK;
drop table if exists czy;
drop index if exists dbtable.dbtable_PK;
drop table if exists dbtable;
drop index if exists diobo.diobo2_FK;
drop index if exists diobo.diobo_FK;
drop index if exists diobo.diobo_PK;
drop table if exists diobo;
drop index if exists dqkc.dqkc2_FK;
drop index if exists dqkc.dqkc_FK;
drop index if exists dqkc.dqkc_PK;
drop table if exists dqkc;
drop index if exists gys.gys_PK;
drop table if exists gys;
drop index if exists inclu.inclu2_FK;
drop index if exists inclu.inclu_FK;
drop index if exists inclu.inclu_PK;
drop table if exists inclu;
drop index if exists include.include2_FK;
drop index if exists include.include_FK;
drop index if exists include.include_PK;
drop table if exists include;
drop index if exists kehu.kehu_PK;
drop table if exists kehu;
drop index if exists pdtable.pandian_FK;
drop index if exists pdtable.pdtable_PK;
drop table if exists pdtable;
drop index if exists rktable.ruku_FK;
drop index if exists rktable.rktable_PK;
drop table if exists rktable;
drop index if exists shop.shop_PK;
drop table if exists shop;
drop index if exists storage.管理_FK;
drop index if exists storage.storage_PK;
drop table if exists storage;
drop index if exists supply.supply2_FK;
drop index if exists supply.supply_FK;
drop index if exists supply.supply_PK;
drop table if exists supply;
drop index if exists "user".user_PK;
drop table if exists "user";
/*==============================================================*/
/* Table: baohan */
/*==============================================================*/
create table baohan
(
sid integer not null,
ckid integer not null,
constraint PK_BAOHAN primary key clustered (sid, ckid)
);
/*==============================================================*/
/* Index: baohan_PK */
/*==============================================================*/
create unique clustered index baohan_PK on baohan (
sid ASC,
ckid ASC
);
/*==============================================================*/
/* Index: baohan_FK */
/*==============================================================*/
create index baohan_FK on baohan (
sid ASC
);
/*==============================================================*/
/* Index: baohan2_FK */
/*==============================================================*/
create index baohan2_FK on baohan (
ckid ASC
);
/*==============================================================*/
/* Table: bh */
/*==============================================================*/
create table bh
(
sid integer not null,
rid integer not null,
constraint PK_BH primary key clustered (sid, rid)
);
/*==============================================================*/
/* Index: bh_PK */
/*==============================================================*/
create unique clustered index bh_PK on bh (
sid ASC,
rid ASC
);
/*==============================================================*/
/* Index: bh_FK */
/*==============================================================*/
create index bh_FK on bh (
sid ASC
);
/*==============================================================*/
/* Index: bh2_FK */
/*==============================================================*/
create index bh2_FK on bh (
rid ASC
);
/*==============================================================*/
/* Table: bstable */
/*==============================================================*/
create table bstable
(
lid integer not null,
wid integer null,
ldate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
lqty integer not null,
ltp float not null,
tlqty integer not null,
note varchar(20) null,
constraint PK_BSTABLE primary key (lid)
);
/*==============================================================*/
/* Index: bstable_PK */
/*==============================================================*/
create unique index bstable_PK on bstable (
lid ASC
);
/*==============================================================*/
/* Index: baosun_FK */
/*==============================================================*/
create index baosun_FK on bstable (
wid ASC
);
/*==============================================================*/
/* Table: buy */
/*==============================================================*/
create table buy
(
sid integer not null,
cid integer not null,
constraint PK_BUY primary key clustered (sid, cid)
);
/*==============================================================*/
/* Index: buy_PK */
/*==============================================================*/
create unique clustered index buy_PK on buy (
sid ASC,
cid ASC
);
/*==============================================================*/
/* Index: buy_FK */
/*==============================================================*/
create index buy_FK on buy (
sid ASC
);
/*==============================================================*/
/* Index: buy2_FK */
/*==============================================================*/
create index buy2_FK on buy (
cid ASC
);
/*==============================================================*/
/* Table: bytable */
/*==============================================================*/
create table bytable
(
fid integer not null,
wid integer null,
fdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rup float not null,
fqty integer not null,
ftp float not null,
tfqty integer not null,
note varchar(20) null,
constraint PK_BYTABLE primary key (fid)
);
/*==============================================================*/
/* Index: bytable_PK */
/*==============================================================*/
create unique index bytable_PK on bytable (
fid ASC
);
/*==============================================================*/
/* Index: baoyi_FK */
/*==============================================================*/
create index baoyi_FK on bytable (
wid ASC
);
/*==============================================================*/
/* Table: cktable */
/*==============================================================*/
create table cktable
(
ckid integer not null,
cid integer null,
wid integer null,
ckdate timestamp null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
cup float not null,
cqty integer not null,
ctp float not null,
tckqty integer null,
note varchar(20) null,
constraint PK_CKTABLE primary key (ckid)
);
/*==============================================================*/
/* Index: cktable_PK */
/*==============================================================*/
create unique index cktable_PK on cktable (
ckid ASC
);
/*==============================================================*/
/* Index: chuku_FK */
/*==============================================================*/
create index chuku_FK on cktable (
wid ASC
);
/*==============================================================*/
/* Index: shenqing_FK */
/*==============================================================*/
create index shenqing_FK on cktable (
cid ASC
);
/*==============================================================*/
/* Table: conta */
/*==============================================================*/
create table conta
(
sid integer not null,
lid integer not null,
constraint PK_CONTA primary key clustered (sid, lid)
);
/*==============================================================*/
/* Index: conta_PK */
/*==============================================================*/
create unique clustered index conta_PK on conta (
sid ASC,
lid ASC
);
/*==============================================================*/
/* Index: conta_FK */
/*==============================================================*/
create index conta_FK on conta (
sid ASC
);
/*==============================================================*/
/* Index: conta2_FK */
/*==============================================================*/
create index conta2_FK on conta (
lid ASC
);
/*==============================================================*/
/* Table: contain */
/*==============================================================*/
create table contain
(
sid integer not null,
pid char(10) not null,
constraint PK_CONTAIN primary key clustered (sid, pid)
);
/*==============================================================*/
/* Index: contain_PK */
/*==============================================================*/
create unique clustered index contain_PK on contain (
sid ASC,
pid ASC
);
/*==============================================================*/
/* Index: contain_FK */
/*==============================================================*/
create index contain_FK on contain (
sid ASC
);
/*==============================================================*/
/* Index: contain2_FK */
/*==============================================================*/
create index contain2_FK on contain (
pid ASC
);
/*==============================================================*/
/* Table: czy */
/*==============================================================*/
create table czy
(
eno integer not null,
uname char(10) null,
password char(20) null,
ename char(8) not null,
sex char(2) null,
dename char(20) null,
tel char(11) null,
"add" char(20) null,
state char(2) null,
constraint PK_CZY primary key (eno)
);
/*==============================================================*/
/* Index: czy_PK */
/*==============================================================*/
create unique index czy_PK on czy (
eno ASC
);
/*==============================================================*/
/* Index: yongyou_FK */
/*==============================================================*/
create index yongyou_FK on czy (
uname ASC,
password ASC
);
/*==============================================================*/
/* Table: dbtable */
/*==============================================================*/
create table dbtable
(
tid integer not null,
tdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
dbqty integer not null,
ttp float not null,
tdbqty integer not null,
note varchar(20) null,
constraint PK_DBTABLE primary key (tid)
);
/*==============================================================*/
/* Index: dbtable_PK */
/*==============================================================*/
create unique index dbtable_PK on dbtable (
tid ASC
);
/*==============================================================*/
/* Table: diobo */
/*==============================================================*/
create table diobo
(
wid integer not null,
tid integer not null,
constraint PK_DIOBO primary key clustered (wid, tid)
);
/*==============================================================*/
/* Index: diobo_PK */
/*==============================================================*/
create unique clustered index diobo_PK on diobo (
wid ASC,
tid ASC
);
/*==============================================================*/
/* Index: diobo_FK */
/*==============================================================*/
create index diobo_FK on diobo (
wid ASC
);
/*==============================================================*/
/* Index: diobo2_FK */
/*==============================================================*/
create index diobo2_FK on diobo (
tid ASC
);
/*==============================================================*/
/* Table: dqkc */
/*==============================================================*/
create table dqkc
(
wid integer not null,
sid integer not null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
inqty varchar(10) not null,
tkp float not null,
twqty integer not null,
note varchar(20) null,
constraint PK_DQKC primary key clustered (wid, sid)
);
/*==============================================================*/
/* Index: dqkc_PK */
/*==============================================================*/
create unique clustered index dqkc_PK on dqkc (
wid ASC,
sid ASC
);
/*==============================================================*/
/* Index: dqkc_FK */
/*==============================================================*/
create index dqkc_FK on dqkc (
wid ASC
);
/*==============================================================*/
/* Index: dqkc2_FK */
/*==============================================================*/
create index dqkc2_FK on dqkc (
sid ASC
);
/*==============================================================*/
/* Table: gys */
/*==============================================================*/
create table gys
(
gid integer not null,
gname char(8) not null,
company char(20) null,
tel char(11) null,
mail varchar(20) null,
gadd varchar(20) null,
ghzt char(2) null,
note varchar(20) null,
constraint PK_GYS primary key (gid)
);
/*==============================================================*/
/* Index: gys_PK */
/*==============================================================*/
create unique index gys_PK on gys (
gid ASC
);
/*==============================================================*/
/* Table: inclu */
/*==============================================================*/
create table inclu
(
sid integer not null,
tid integer not null,
constraint PK_INCLU primary key clustered (sid, tid)
);
/*==============================================================*/
/* Index: inclu_PK */
/*==============================================================*/
create unique clustered index inclu_PK on inclu (
sid ASC,
tid ASC
);
/*==============================================================*/
/* Index: inclu_FK */
/*==============================================================*/
create index inclu_FK on inclu (
sid ASC
);
/*==============================================================*/
/* Index: inclu2_FK */
/*==============================================================*/
create index inclu2_FK on inclu (
tid ASC
);
/*==============================================================*/
/* Table: include */
/*==============================================================*/
create table include
(
fid integer not null,
sid integer not null,
constraint PK_INCLUDE primary key clustered (fid, sid)
);
/*==============================================================*/
/* Index: include_PK */
/*==============================================================*/
create unique clustered index include_PK on include (
fid ASC,
sid ASC
);
/*==============================================================*/
/* Index: include_FK */
/*==============================================================*/
create index include_FK on include (
fid ASC
);
/*==============================================================*/
/* Index: include2_FK */
/*==============================================================*/
create index include2_FK on include (
sid ASC
);
/*==============================================================*/
/* Table: kehu */
/*==============================================================*/
create table kehu
(
cid integer not null,
cname char(8) not null,
comp char(20) null,
tel char(11) null,
mail varchar(20) null,
cadd varchar(20) null,
stbuy char(1) null,
note varchar(20) null,
constraint PK_KEHU primary key (cid)
);
/*==============================================================*/
/* Index: kehu_PK */
/*==============================================================*/
create unique index kehu_PK on kehu (
cid ASC
);
/*==============================================================*/
/* Table: pdtable */
/*==============================================================*/
create table pdtable
(
pid char(10) not null,
wid integer null,
pdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
inqty varchar(10) not null,
tkp float not null,
twqty integer null,
pdup float not null,
pdqty integer not null,
tpbp float not null,
tpdqty integer not null,
note varchar(20) null,
constraint PK_PDTABLE primary key (pid)
);
/*==============================================================*/
/* Index: pdtable_PK */
/*==============================================================*/
create unique index pdtable_PK on pdtable (
pid ASC
);
/*==============================================================*/
/* Index: pandian_FK */
/*==============================================================*/
create index pandian_FK on pdtable (
wid ASC
);
/*==============================================================*/
/* Table: rktable */
/*==============================================================*/
create table rktable
(
rid integer not null,
wid integer null,
rdate timestamp not null,
lister char(8) null,
auditor char(8) null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
rkup float not null,
rqty integer not null,
rtp float not null,
trqty integer not null,
note varchar(20) null,
constraint PK_RKTABLE primary key (rid)
);
/*==============================================================*/
/* Index: rktable_PK */
/*==============================================================*/
create unique index rktable_PK on rktable (
rid ASC
);
/*==============================================================*/
/* Index: ruku_FK */
/*==============================================================*/
create index ruku_FK on rktable (
wid ASC
);
/*==============================================================*/
/* Table: shop */
/*==============================================================*/
create table shop
(
sid integer not null,
sname char(20) not null,
model char(8) null,
brand varchar(10) null,
kcxx integer null,
kcsx integer null,
"stop" char(1) null,
note varchar(20) null,
constraint PK_SHOP primary key (sid)
);
/*==============================================================*/
/* Index: shop_PK */
/*==============================================================*/
create unique index shop_PK on shop (
sid ASC
);
/*==============================================================*/
/* Table: storage */
/*==============================================================*/
create table storage
(
wid integer not null,
eno integer null,
wname char(20) not null,
wdd varchar(20) null,
area char(10) null,
whead char(8) null,
wtel char(11) null,
ty char(1) null,
note varchar(20) null,
constraint PK_STORAGE primary key (wid)
);
/*==============================================================*/
/* Index: storage_PK */
/*==============================================================*/
create unique index storage_PK on storage (
wid ASC
);
/*==============================================================*/
/* Index: 管理_FK */
/*==============================================================*/
create index 管理_FK on storage (
eno ASC
);
/*==============================================================*/
/* Table: supply */
/*==============================================================*/
create table supply
(
gid integer not null,
sid integer not null,
constraint PK_SUPPLY primary key clustered (gid, sid)
);
/*==============================================================*/
/* Index: supply_PK */
/*==============================================================*/
create unique clustered index supply_PK on supply (
gid ASC,
sid ASC
);
/*==============================================================*/
/* Index: supply_FK */
/*==============================================================*/
create index supply_FK on supply (
gid ASC
);
/*==============================================================*/
/* Index: supply2_FK */
/*==============================================================*/
create index supply2_FK on supply (
sid ASC
);
/*==============================================================*/
/* Table: "user" */
/*==============================================================*/
create table "user"
(
uname char(10) not null,
password char(20) not null,
constraint PK_USER primary key (uname, password)
);
/*==============================================================*/
/* Index: user_PK */
/*==============================================================*/
create unique index user_PK on "user" (
uname ASC,
password ASC
);
alter table baohan
add constraint FK_BAOHAN_BAOHAN_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table baohan
add constraint FK_BAOHAN_BAOHAN2_CKTABLE foreign key (ckid)
references cktable (ckid)
on update restrict
on delete restrict;
alter table bh
add constraint FK_BH_BH_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table bh
add constraint FK_BH_BH2_RKTABLE foreign key (rid)
references rktable (rid)
on update restrict
on delete restrict;
alter table bstable
add constraint FK_BSTABLE_BAOSUN_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table buy
add constraint FK_BUY_BUY_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table buy
add constraint FK_BUY_BUY2_KEHU foreign key (cid)
references kehu (cid)
on update restrict
on delete restrict;
alter table bytable
add constraint FK_BYTABLE_BAOYI_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table cktable
add constraint FK_CKTABLE_CHUKU_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table cktable
add constraint FK_CKTABLE_SHENQING_KEHU foreign key (cid)
references kehu (cid)
on update restrict
on delete restrict;
alter table conta
add constraint FK_CONTA_CONTA_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table conta
add constraint FK_CONTA_CONTA2_BSTABLE foreign key (lid)
references bstable (lid)
on update restrict
on delete restrict;
alter table contain
add constraint FK_CONTAIN_CONTAIN_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table contain
add constraint FK_CONTAIN_CONTAIN2_PDTABLE foreign key (pid)
references pdtable (pid)
on update restrict
on delete restrict;
alter table czy
add constraint FK_CZY_YONGYOU_USER foreign key (uname, password)
references "user" (uname, password)
on update restrict
on delete restrict;
alter table diobo
add constraint FK_DIOBO_DIOBO_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table diobo
add constraint FK_DIOBO_DIOBO2_DBTABLE foreign key (tid)
references dbtable (tid)
on update restrict
on delete restrict;
alter table dqkc
add constraint FK_DQKC_DQKC_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table dqkc
add constraint FK_DQKC_DQKC2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table inclu
add constraint FK_INCLU_INCLU_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table inclu
add constraint FK_INCLU_INCLU2_DBTABLE foreign key (tid)
references dbtable (tid)
on update restrict
on delete restrict;
alter table include
add constraint FK_INCLUDE_INCLUDE_BYTABLE foreign key (fid)
references bytable (fid)
on update restrict
on delete restrict;
alter table include
add constraint FK_INCLUDE_INCLUDE2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;
alter table pdtable
add constraint FK_PDTABLE_PANDIAN_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table rktable
add constraint FK_RKTABLE_RUKU_STORAGE foreign key (wid)
references storage (wid)
on update restrict
on delete restrict;
alter table storage
add constraint FK_STORAGE_管理_CZY foreign key (eno)
references czy (eno)
on update restrict
on delete restrict;
alter table supply
add constraint FK_SUPPLY_SUPPLY_GYS foreign key (gid)
references gys (gid)
on update restrict
on delete restrict;
alter table supply
add constraint FK_SUPPLY_SUPPLY2_SHOP foreign key (sid)
references shop (sid)
on update restrict
on delete restrict;