-
Notifications
You must be signed in to change notification settings - Fork 3
/
sqlqueries.txt
90 lines (77 loc) · 2.38 KB
/
sqlqueries.txt
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
create database playpal_db;
use playpal_db;
create table User(
user_id int auto_increment primary key,
name varchar(30) NOT NULL,
dob date,
age int NOT NULL,
email varchar(40),
address varchar(100),
weight numeric(5,2),
height int,
username varchar(20) NOT NULL UNIQUE,
password varchar(20) NOT NULL,
bmi numeric(4,2));
create table Event(
event_id int auto_increment primary key,
event_name varchar(100) NOT NULL UNIQUE,
sport varchar(100),
ageLimit int,
venue varchar(255),
time time,
date date,
noOfParticipants int);
create table Event_creator(
event_id int,
user_id int,
primary key(event_id),
foreign key(event_id) references Event(event_id),
foreign key(user_id) references User(user_id));
create table Tournament(
tour_id int auto_increment primary key,
noOfTeams int,
tour_name varchar(255) NOT NULL UNIQUE,
entryFee numeric(5,2),
tour_ageLimit int,
tour_venue varchar(20),
tour_time varchar(20),
tour_date varchar(20),
tour_noOfParticipants int);
create table tourn_participation(
user_id int,
tour_id int,
foreign key(user_id) references User(user_id),
foreign key(tour_id) references Tournament(tour_id),
primary key(user_id, tour_id));
create table equipment(
equip_id int auto_increment,
userid_owner int,
userid_rentee int,
EquipName varchar(50) NOT NULL,
address varchar(100),
rentamt numeric(10,2),
status varchar(255),
primary key(equip_id),
foreign key(userid_owner) references User(user_id),
foreign key(userid_rentee) references User(user_id));
NEW EDIT QUERIES:
alter table user add gender varchar(15);
alter table user drop height;
alter table user add height_in_feet int;
alter table user add height_in_inches int;
alter table user drop password;
alter table user add password varchar(100);
alter table user drop event_id;
alter table Event add user_id int;
alter table event add constraint foreign key(user_id) references user(user_id);
alter table Tournament add tour_sport varchar(50);
alter table tournament modify tour_time varchar(100);
alter table tournament modify tour_date varchar(100);
alter table tournament modify entryFee decimal(10,2);
alter table tournament add constraint foreign key(tour_owner) references user(user_id);
alter table user drop dob;
alter table user add balance numeric(10,2);
alter table tournament add tour_owner int;
alter table equipment add description varchar(255);
alter table user add latitude numeric(30,20);
alter table user add longitude numeric(30,20);