-
Notifications
You must be signed in to change notification settings - Fork 0
/
hw6.sql
45 lines (39 loc) · 897 Bytes
/
hw6.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
create table customer
(
id int auto_increment
primary key,
firstname varchar(20) not null,
constraint id
unique (id)
);
create table customer_order_assosiation
(
id int auto_increment
primary key,
customer_id int not null,
orders_id int not null,
constraint id
unique (id)
);
create table orders
(
id int auto_increment
primary key,
order_number varchar(20) not null,
product date null,
constraint id
unique (id)
);
create table returns
(
id int auto_increment
primary key,
product varchar(20) null,
return_number int null,
constraint id
unique (id),
constraint returns_ibfk_1
foreign key (return_number) references orders (id)
);
create index return_number
on returns (return_number);