-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEMS_DB.sql
125 lines (104 loc) · 3.83 KB
/
EMS_DB.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
use EMS_DB;
create table venue(
v_name varchar(25),
location varchar(25),
venue_id varchar(25) not null,primary key(venue_id));
create table client(
c_id varchar(25) not null,
payment_status varchar(25) not null DEFAULT 'UNPAID',
advance_payment int not null default 2000,
total_payment int not null default 0,
client_type varchar(25),primary key(c_id));
create table event(
event_id varchar(25) not null,
e_name varchar(25),
c_id varchar(25),
venue_id varchar(25),primary key(event_id),foreign key(venue_id) references venue(venue_id),foreign key(c_id) references client(c_id));
create table event_schedule(
e_date date,
e_start_time time not null,
venue_id varchar(25),
event_id varchar(25),
c_id varchar(25),primary key(e_start_time,e_date,venue_id),
e_description varchar(25) default "DESCRIPTION",
foreign key(venue_id) references venue(venue_id),foreign key(event_id) references event(event_id));
create table wedding_info(
c_id varchar(25) not null,
c_name varchar(25),primary key(c_id)
);
create table w_contact_details(
c_id varchar(25) not null,
W_address varchar(25) not null default "Address",
W_emailid varchar(25) not null default "example@gmail.com",
contact_No varchar(25) not null,primary key(contact_No,c_id),foreign key(c_id) references wedding_info(c_id)
);
create table seminar_info(
c_id varchar(25) not null,
c_name varchar(25),primary key(c_id)
);
create table s_contact_details(
c_id varchar(25) not null,
s_address varchar(25) not null default "Address",
s_emailid varchar(25) not null default "example@gmail.com",
contact_No varchar(25) not null,primary key(contact_No,c_id),foreign key(c_id) references seminar_info(c_id)
);
create table conference_info(
c_id varchar(25) not null,
c_name varchar(25),primary key(c_id)
);
create table c_contact_details(
c_id varchar(25) not null,
contact_No varchar(25) not null,primary key(contact_No,c_id),
c_address varchar(25) not null default "Address",
c_emailid varchar(25) not null default "example@gmail.com",
foreign key(c_id) references conference_info(c_id)
);
create table inventory(
model_no varchar(25) not null,
item_name varchar(25),
event_id varchar(25) not null,
primary key (model_no,event_id), foreign key(event_id) references event(event_id) );
create table staff(
s_id varchar(25) not null,
s_type varchar(25) ,
primary key (s_id) );
create table production_info (
s_id varchar(25) not null,
p_name varchar(25),
primary key (s_id),
foreign key(s_id) references staff(s_id) );
create table catering_info (
s_id varchar(25) not null,
ca_name varchar(25),
primary key (s_id), foreign key(s_id) references staff(s_id) );
create table ca_salary_details (
contact_no int not null,
salary int,
primary key (contact_no));
create table ca_contact_details (
contact_no int not null,
s_id varchar(25) not null,
ca_address varchar(25) not null default "Address",
ca_emailid varchar(25) not null default "example@gmail.com",
primary key (contact_no,s_id),
foreign key(contact_no) references ca_salary_details(contact_no), foreign key(s_id) references catering_info(s_id) );
create table p_salary_details ( contact_no int not null,
salary int,
primary key (contact_no)
);
create table p_contact_details ( contact_no int not null,
s_id varchar(25) not null,
primary key (contact_no,s_id),
p_address varchar(25) not null default "Address",
p_emailid varchar(25) not null default "example@gmail.com",
foreign key(contact_no) references p_salary_details(contact_no),
foreign key(s_id) references production_info(s_id)
);
create table Users(
u_id varchar(25) not null,
user_name varchar(25) not null,
user_designation varchar(25) not null,
user_password varchar(25) not null,
user_contact_no int not null,
user_address varchar(25) not null,
primary key(u_id));