-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.sql
108 lines (80 loc) · 3.06 KB
/
create.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
drop schema if exists MovieBooking;
create schema MovieBooking;
use MovieBooking;
set foreign_key_checks = 0 ;
drop table if exists users;
drop table if exists admin;
drop table if exists manager;
drop table if exists comments;
set foreign_key_checks = 1;
create table users(
id int NOT NULL auto_increment,
primary key(id),
first_name varchar(255),
last_name varchar(255) NOT NULL,
user_name varchar(255),
password varchar(255),
email varchar(255),
phone varchar(255),
dob date
);
Insert into users values(default,'alice','alice','alice','alice','alice@gmail.com','123-123-1234','2020-12-12');
Insert into users values(default,'bob','bob','bob','bob','bob@gmail.com','123-123-1234','2020-12-12');
create table admin(
id int NOT NULL auto_increment,
primary key(id),
user_name varchar(255),
password varchar(255)
);
Insert into admin(user_name,password) values ('admin','admin');
create table manager(
id int NOT NULL auto_increment,
primary key(id),
first_name varchar(255),
last_name varchar(255) NOT NULL,
user_name varchar(255),
password varchar(255),
email varchar(255),
phone varchar(255),
dob date
);
Insert into manager values(default,'manager','manager','manager','manager','manager@gmail.com','123-123-1234','2020-12-12');
Insert into manager values(default,'charlie','charlie','charlie','charlie','charlie@gmail.com','123-123-1234','2020-12-12');
Insert into manager values(default,'dan','dan','dan','dan','dan@gmail.com','123-123-1234','2020-12-12');
create table movie(
id int not null auto_increment,
unique key(id),
movie_name varchar(255) not null,
primary key(movie_name),
movie_time enum('12 PM','5 PM','9 PM'),
details varchar(255),
genre varchar(255)
);
insert into movie values (default,'Thor','12 PM','Release 2016','Action');
insert into movie values (default,'Iron Man','5 PM','Release 2015','Action');
insert into movie values (default,'Interstellar','9 PM','Release 2018','Sci-fi');
insert into movie values (default,'Hulk','12 PM','Release 2017','Comedy');
insert into movie values (default,'Iron Man 3','5 PM','Release 2019','Action');
create table tickets(
id int not null auto_increment,
primary key(id),
user_name varchar(255),
no_of_tickets varchar(255) default 1,
ticket_type enum('Standard','Gold','Platinum'),
seat_no int,
section varchar(255),
movie_name varchar(255),
movie_time varchar(255),
-- constraint ticket_user_generalization foreign key(user_name) references users(user_name),
constraint ticket_movie_name_generalization foreign key(movie_name) references movie(movie_name)
on update cascade on delete cascade
-- constraint ticket_movie_time_generalization foreign key(movie_time) references movie(movie_time)
);
insert into tickets values (default,'alice',default,'Standard',1,'a','Thor','12 PM');
create table comments(
id int not null auto_increment,
primary key (id),
user_name varchar(255),
comments varchar(255)
);
insert into comments values(default,'alice','Nice Threatre');