-
Notifications
You must be signed in to change notification settings - Fork 0
/
Creating tables.sql
81 lines (47 loc) · 1.34 KB
/
Creating tables.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
create table customers(
customer_ID int,
customer_name varchar(50),
customer_phone_num int,
constraint cust_id primary key (customer_ID)
);
create table agents(
agent_id int,
assigned_cost int,
constraint ag_id primary key(agent_id)
);
create table entertainers(
entertainer_id int,
entertainer_phone int,
constraint ent_id primary key(entertainer_id)
);
create table members(
members_id int,
members_rate int,
constraint memb_id primary key (members_id)
);
create table engagmnets(
engagment_id int,
category varchar(40),
cus_id int REFERENCES customers(customer_ID),
ag_id int REFERENCES agents(customer_ID),
ent_id int REFERENCES Entertainers(entertainer_id),
constraint eng_id primary key(engagment_id)
);
create table musical_Styles( --this is the only validation table exists
style_id int,
constraint st_id primary key(style_id)
)
--Starting to create linkage tables
create table musical_preferences(
For_Custid int REFERENCES customers(customer_ID),
For_Stid int REFERENCES Musical_Styles(style_id)
);
create table Entertainer_styles(
For_Custid int REFERENCES customers(customer_ID),
For_Stid int REFERENCES Musical_Styles(style_id),
For_entid int REFERENCES Entertainers(entertainer_id)
);
create table Entertainer_members(
For_membid int REFERENCES Members(members_id),
For_entid int REFERENCES Entertainers(entertainer_id)
);