forked from isha2912/chemistryLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
72 lines (65 loc) · 1.87 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
CREATE TABLE SUPPLIER(
Supplier_No INTEGER PRIMARY KEY ,
Supplier_Name VARCHAR(30) NOT NULL,
Supplier_Contact_No VARCHAR(13) NOT NULL,
Company_Name VARCHAR(40),
Supplier_Address VARCHAR(100),
Company_Contact_No VARCHAR(13)
);
CREATE TABLE CHEMICALS(
Sno INTEGER(4) UNIQUE,
Chem_Name VARCHAR(50) PRIMARY KEY,
Molecular_Formula VARCHAR(20),
Stock_Available DECIMAL(9,3) NOT NULL
);
CREATE TABLE CHEM_ORDER(
Sno INTEGER(3) UNIQUE ,
C_name varchar(50),
No_packs INTEGER(6),
Supplied_By INTEGER,
Order_Date Date,
Date_of_Delivery Date,
Order_Number INTEGER primary key,
Price decimal(9,2),
Total_price decimal(9,2),
Stock_bought decimal(9,3),
FOREIGN KEY (Supplied_By) REFERENCES SUPPLIER(Supplier_No),
FOREIGN KEY (C_name) references CHEMICALS(Chem_Name)
);
CREATE TABLE GLASSWARE(
Sno INTEGER UNIQUE ,
Glass_Name VARCHAR(50) primary key,
Capacity VARCHAR(10),
Quantiy_Available integer(3)
);
create table GLASS_ORDER(
Sno INTEGER(3) UNIQUE ,
G_name varchar(50),
Price decimal(9,3),
Supplied_By INTEGER,
Order_Date Date,
Date_of_Delivery Date,
Total_price decimal(9,3),
No_bought integer,
Order_Number INTEGER primary key,
FOREIGN KEY (Supplied_By) REFERENCES SUPPLIER(Supplier_No),
foreign key (G_name) references GLASSWARE(Glass_Name)
);
CREATE TABLE INSTRUMENT(
Sno INTEGER(3) UNIQUE ,
Inst_Name VARCHAR(50) primary key,
Number_Of_Units_Present INTEGER(3)
);
create table INST_ORDER(
Sno INTEGER(3) UNIQUE ,
I_name varchar(50),
Supplied_By INTEGER,
Order_Date Date,
Date_of_Delivery Date,
Price decimal(9,3),
Order_Number INTEGER primary key,
No_bought integer,
Total_price decimal(9,3),
FOREIGN KEY (Supplied_By) REFERENCES SUPPLIER(Supplier_No),
foreign key (I_name) references INST_ORDER(Inst_Name)
);