-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtable_structure.sql
52 lines (45 loc) · 1.65 KB
/
table_structure.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
create table suppliers(
supplier_id number,
supplier_name varchar(20) unique not null,
phone_number number unique not null,
email varchar(30) unique,
primary key (supplier_id)
);
create table products(
product_id number not null,
name varchar(50) not null,
Category varchar(20),
price number not null,
supplier_id number not null,
availability varchar(1) not null,
primary key (product_id),
foreign key (supplier_id) references suppliers(supplier_id)
);
create table Customer(
customer_id number not null,
First_name varchar(15) not null,
Last_name varchar(15),
phone_number number unique not null,
city varchar(10) not null,
zip number,
street number,
primary key (customer_id)
);
create table c_order(
order_date date not null,
order_id number,
customer_id number not null,
product_id number not null,
primary key (order_id),
foreign key (customer_id) references Customer(customer_id),
foreign key (product_id) references products(product_id)
);
create table Shipping(
courrier_service varchar(20) not null,
shipping_date date not null,
customer_id number not null,
track_id number,
primary key (track_id),
foreign key (customer_id) references Customer(customer_id)
);
commit;