-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
32 lines (29 loc) · 966 Bytes
/
database.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
DROP DATABASE IF EXISTS SportsEventer;
CREATE DATABASE SportsEventer;
USE SportsEventer;
CREATE TABLE Events(
event_id INT PRIMARY KEY auto_increment,
created_by VARCHAR(40) NOT NULL,
sport VARCHAR(15),
people_participating INT,
people_needed INT,
event_date VARCHAR(50),
event_time VARCHAR(30),
location VARCHAR(150),
price FLOAT,
description VARCHAR(300)
);
CREATE TABLE Users(
user_id INT PRIMARY KEY NOT NULL auto_increment,
email VARCHAR(60) NOT NULL,
username VARCHAR(40) NOT NULL,
pwd VARCHAR(300) NOT NULL,
confirmed BOOL DEFAULT 0
);
CREATE TABLE UsersEvents(
id INT PRIMARY KEY NOT NULL auto_increment,
event_id INT NOT NULL,
FOREIGN KEY(event_id) REFERENCES Events(event_id),
user_id INT NOT NULL,
FOREIGN KEY(user_id) REFERENCES Users(user_id)
);