-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit_db.sql
35 lines (31 loc) · 829 Bytes
/
init_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
use munguars_db;
drop table if exists Users;
drop table if exists Events;
drop table if exists CreatedBy;
create table Users(
stuid int not null auto_increment,
name varchar(50) not null,
email varchar(50) not null unique,
hashed_pwd varchar(100) not null,
primary key(stuid),
index(email)
);
create table Events(
eid int not null auto_increment,
title varchar(100) not null,
descrip varchar (250) not null,
time datetime not null,
location varchar(50),
primary key(eid)
);
create table CreatedBy(
eid int not null,
stuid int not null,
primary key (eid, stuid),
foreign key (eid) references Events(eid)
on update cascade
on delete cascade,
foreign key (stuid) references Users(stuid)
on update cascade
on delete cascade
);