-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex2_lab5.sql
More file actions
36 lines (36 loc) · 978 Bytes
/
Copy pathex2_lab5.sql
File metadata and controls
36 lines (36 loc) · 978 Bytes
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
create table C_Group(
group_id INTEGER PRIMARY KEY
);
create table Company(
company_id INTEGER PRIMARY KEY
);
create table Item(
item_id INTEGER PRIMARY KEY
);
create table plant(
plant_id INTEGER PRIMARY KEY
);
create table production(
itemId INTEGER,
plantId INTEGER,
foreign key(item_id) references Item(item_id),
foreign key(plant_id) references plant(plant_id)
);
create table companyPlants(
company_id INTEGER,
plant_id INTEGER,
foreign key(company_id) references Company(company_id),
foreign key(plant_id) references plant(plant_id)
);
create table groupCompanies(
company_id INTEGER,
group_id INTEGER,
foreign key(company_id) references Company(company_id),
foreign key(group_id) references C_Group(group_id)
);
create table Structure(
company1 INTEGER,
company2 INTEGER,
foreign key(company1) references Company(company_id),
foreign key(company2) references Company(company_id)
);