You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.3 KiB
98 lines
2.3 KiB
create table T_Drugs(
|
|
ID varchar(5),
|
|
name varchar(20),
|
|
num numeric(3,0),
|
|
unit_price numeric(5,2),
|
|
|
|
primary key (ID));
|
|
|
|
create table T_Norms(
|
|
ID varchar(5),
|
|
feather varchar(10),
|
|
|
|
primary key (ID));
|
|
|
|
create table T_Vendor(
|
|
ID varchar(5),
|
|
name varchar(20),
|
|
address varchar(64),
|
|
phonenumber varchar(11),
|
|
monitor varchar(5),
|
|
zipcode varchar(6),
|
|
|
|
primary key (ID));
|
|
|
|
create table T_Request(
|
|
ID varchar(5),
|
|
num numeric(4,0),
|
|
req_date date,
|
|
|
|
primary key (ID));
|
|
|
|
create table T_User(
|
|
ID varchar(5),
|
|
name varchar(10),
|
|
sex char(1),
|
|
age numeric(2,0),
|
|
phonenumber varchar(11),
|
|
account varchar(20) not null,
|
|
password varchar(20) not null,
|
|
role varchar(10) not null,
|
|
|
|
primary key (ID));
|
|
|
|
create table T_Department(
|
|
ID varchar(5),
|
|
name varchar(10),
|
|
member numeric(3,0),
|
|
floor varchar(2),
|
|
|
|
primary key (ID));
|
|
|
|
create table T_Type(
|
|
d_id varchar(5),
|
|
n_id varchar(5),
|
|
|
|
primary key (d_id),
|
|
foreign key (d_id) references T_Drugs(ID),
|
|
foreign key (n_id) references T_Norms(ID));
|
|
|
|
create table T_Produce(
|
|
d_id varchar(5),
|
|
v_id varchar(5),
|
|
|
|
primary key (d_id,v_id),
|
|
foreign key (d_id) references T_Drugs(ID),
|
|
foreign key (v_id) references T_Vendor(ID));
|
|
|
|
create table T_Require(
|
|
d_id varchar(5),
|
|
r_id varchar(5),
|
|
|
|
primary key (d_id,r_id),
|
|
foreign key (d_id) references T_Drugs(ID),
|
|
foreign key (r_id) references T_Request(ID));
|
|
|
|
create table T_Commit(
|
|
r_id varchar(5),
|
|
u_id varchar(5),
|
|
|
|
primary key (r_id),
|
|
foreign key (r_id) references T_Request(ID),
|
|
foreign key (u_id) references T_User(ID));
|
|
|
|
create table T_Belong(
|
|
u_id varchar(5),
|
|
d_id varchar(5),
|
|
|
|
primary key (u_id),
|
|
foreign key (u_id) references T_User(ID),
|
|
foreign key (d_id) references T_Department(ID));
|
|
|
|
create table T_Sum_Commit(
|
|
r_id varchar(5),
|
|
d_id varchar(5),
|
|
|
|
primary key (r_id),
|
|
foreign key (r_id) references T_Request(ID),
|
|
foreign key (d_id) references T_Department(ID)); |