forked from FatimaAbdimalik/Feedback-Compass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compass copy.sql
271 lines (244 loc) · 11 KB
/
compass copy.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
-- drop table if exists feedbacktable
-- CASCADE;
-- drop table if exists students
-- CASCADE;
-- drop table if exists mentors
-- CASCADE;
-- drop table if exists users
-- CASCADE;
-- drop table if exists cohorts
-- CASCADE;
-- drop table if exists courses
-- CASCADE;
-- drop table if exists cities
-- CASCADE;
CREATE TABLE cities
(
id SERIAL PRIMARY KEY,
cities_name VARCHAR(100),
address VARCHAR(500)
);
CREATE TABLE courses
(
id SERIAL PRIMARY KEY,
course_name VARCHAR(300)
);
CREATE TABLE cohorts
(
cohort_name VARCHAR(300) PRIMARY KEY,
start_date DATE,
end_date DATE,
course_id INT REFERENCES courses(id)
);
CREATE TABLE users
(
id SERIAL PRIMARY KEY,
user_type VARCHAR(100) NOT NULL,
name VARCHAR(30) NOT NULL,
surname VARCHAR(30) NOT NULL,
email VARCHAR(120) NOT NULL,
phone_number VARCHAR(150),
password VARCHAR(30) NOT NULL,
city_id INT REFERENCES cities(id),
cohort_name VARCHAR(300) REFERENCES cohorts(cohort_name),
biography VARCHAR(500),
picture OID
);
CREATE TABLE feedbacktable
(
id SERIAL PRIMARY KEY,
mentor_id INT REFERENCES users(id),
student_id INT REFERENCES users(id),
sent_date DATE NOT NULL,
title VARCHAR(120),
body VARCHAR(300),
response VARCHAR(500)
);
INSERT INTO cities
(cities_name)
VALUES('London'),
('North-West'),
('Glasgow'),
('West-Midlands'),
('Rome'),
('Cape Town'),
('Medellin');
INSERT INTO courses
(course_name)
VALUES
('Full Stack'),
('Intro to Coding');
INSERT INTO cohorts
VALUES('north-west-class3', '2020-02-01', '2020-11-30', 1),
('north-west-class2', '2019-02-01', '2019-11-30', 1);
INSERT INTO cohorts
(cohort_name,start_date,end_date,course_id)
VALUES
('north-west-class1', '2018-02-01', '2017-11-30', 1),
('london-class6', '2019-11-01', '2020-10-01', 1),
('london-class5', '2018-11-01', '2019-10-01', 1),
('london-class4', '2017-11-01', '2018-10-01', 1),
('scotland-class-4', '2020-03-01', '2020-12-31', 1),
('scotland-class-3', '2019-03-01', '2019-12-01', 1),
('scotland-class-2', '2018-03-01', '2018-12-01', 1),
('scotland-class-1', '2017-03-01', '2017-12-31', 1),
('west-midlands-class4', '2020-01-31', '2020-10-30', 1),
('west-midlands-class3', '2019-01-31', '2019-10-30', 1),
('west-midlands-class2', '2018-01-31', '2018-10-30', 1),
('medellin-class1', '2020-02-01', '2020-11-30', 1),
('rome-class1', '2020-03-01', '2020-12-01', 1),
('capetown-class1', '2021-01-31', '2021-10-31', 1);
INSERT INTO users
(user_type,name, surname,email, password,city_id,cohort_name)
VALUES('student', 'Fatima', 'Abdimalik', 'f@gmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email, password,city_id)
VALUES('mentor', 'Ahmad', 'Al', 'ahmed@gmail.com', '123456789', 2);
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Hedyeh', 'Etemadi', 'hedyeh.etemadi@gmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Sulaiman', 'Solo', 'sulaimansolo73505@gmail.com', '123456789', 2, 'north-west-class3'),
('student', 'Leida', 'Gandy', 'leidagandy@hotmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email,password,city_id)
VALUES
('mentor', 'Ahmad', 'Mire', 'afmire877@gmail.com', '123456789', 1),
('mentor', 'Alec', 'A', 'alec@epicb.co.uk', '123456789', 1);
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Layla', 'Jones', 'l@gmail.com', '123456789', 1, 'london-class6'),
('student', 'Noor', 'Saleem', 'noor@gmail.com', '123456789', 1, 'london-class6'),
('student', 'Shahad', 'Fahad', 'shahad@hotmail.com', '123456789', 1, 'london-class5'),
('student', 'Sameer', 'Jama', 'smaeer@gmail.com', '123456789', 1, 'london-class5'),
('student', 'Hani', 'James', 'james@gmail.com', '123456789', 1, 'london-class5'),
('student', 'Ali', 'Shaheen', 'ali@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sara', 'Josh', 'sara@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sara', 'Jones', 'jones@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sahal', 'Rasheed', 'rasheed@gmail.com', '123456789', 3, 'scotland-class-4'),
('student', 'Khadar', 'Hassan', 'khadar@gmail.com', '123456789', 3, 'scotland-class-4'),
('student', 'Ibrahim', 'Saalah', 'ibrahim@gmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Sally', 'James', 'sally@hotmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Fakher', 'Noor', 'fakher@gmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Ned', 'Duncun', 'ned@gmail.com', '123456789', 3, 'scotland-class-1'),
('student', 'Hussien', 'Kamal', 'kamal@gmail.com', '123456789', 3, 'scotland-class-2'),
('student', 'Rahma', 'Fathi', 'rahma@gmail.com', '123456789', 4, 'west-midlands-class4'),
('student', 'David', 'Hewit', 'hewit@gmail.com', '12345', 4, 'west-midlands-class4'),
('student', 'Henarry', 'Camron', 'henarry@gmail.com', '123456789', 4, 'west-midlands-class4'),
('student', 'Rob', 'Obama', 'obama@gmail.com', '12345', 4, 'west-midlands-class3'),
('student', 'Sharron', 'Williams', 'sharron@gmail.com', '12345', 4, 'west-midlands-class2'),
('student', 'Nahla', 'Saeed', 'nahla@gmail.com', '12345', 7, 'medellin-class1'),
('student', 'Hamad', 'Kareem', 'hamad@gmail.com', '123', 7, 'medellin-class1'),
('student', 'Abrar', 'Nikk', 'abrar@gmail.com', '123', 6, 'rome-class1'),
('student', 'Ahamd', 'Raami', 'rami@gmail.com', '123', 5, 'capetown-class1');
INSERT INTO users
(user_type,name, surname,email, password,city_id,cohort_name)
VALUES('student', 'Suzan', 'Mike', 'l@gmail.com', '123456789', 2, 'north-west-class2');
INSERT INTO users
(user_type,name, surname,email, password,city_id)
VALUES
('mentor', 'Mitchell', 'Lloyd', 'mitchelllloyd154@gmail.com', '12345', 2);
INSERT INTO users
(user_type,name, surname,email, password,city_id)
VALUES
('mentor', 'Marko', 'Sustarsic', 'sustarsic.marko@gmail.com', '12345', 2);
INSERT INTO cities
(cities_name)
VALUES('North-West'),
('Glasgow'),
('West-Midlands'),
('Rome'),
('Cape Town'),
('Medellin');
INSERT INTO courses
(course_name)
VALUES
('Full Stack'),
('Intro to Coding');
INSERT INTO cohorts
VALUES('north-west-class3', '2020-02-01', '2020-11-30', 1),
('north-west-class2', '2019-02-01', '2019-11-30', 1);
INSERT INTO cohorts
(cohort_name,start_date,end_date,course_id)
VALUES
('north-west-class1', '2018-02-01', '2017-11-30', 1),
('london-class6', '2019-11-01', '2020-10-01', 1),
('london-class5', '2018-11-01', '2019-10-01', 1),
('london-class4', '2017-11-01', '2018-10-01', 1),
('scotland-class-4', '2020-03-01', '2020-12-31', 1),
('scotland-class-3', '2019-03-01', '2019-12-01', 1),
('scotland-class-2', '2018-03-01', '2018-12-01', 1),
('scotland-class-1', '2017-03-01', '2017-12-31', 1),
('west-midlands-class4', '2020-01-31', '2020-10-30', 1),
('west-midlands-class3', '2019-01-31', '2019-10-30', 1),
('west-midlands-class2', '2018-01-31', '2018-10-30', 1),
('medellin-class1', '2020-02-01', '2020-11-30', 1),
('rome-class1', '2020-03-01', '2020-12-01', 1),
('capetown-class1', '2021-01-31', '2021-10-31', 1);
INSERT INTO users
(user_type,name, surname,email, password,city_id,cohort_name)
VALUES('student', 'Fatima', 'Abdimalik', 'f@gmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email, password,city_id)
VALUES('mentor', 'Ahmad', 'Al', 'ahmed@gmail.com', '123456789', 2);
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Hedyeh', 'Etemadi', 'hedyeh.etemadi@gmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Sulaiman', 'Solo', 'sulaimansolo73505@gmail.com', '123456789', 2, 'north-west-class3'),
('student', 'Leida', 'Gandy', 'leidagandy@hotmail.com', '123456789', 2, 'north-west-class3');
INSERT INTO users
(user_type,name, surname,email,password,city_id)
VALUES
('mentor', 'Ahmad', 'Mire', 'afmire877@gmail.com', '123456789', 1),
('mentor', 'Alec', 'A', 'alec@epicb.co.uk', '123456789', 1);
INSERT INTO users
(user_type,name, surname,email,password,city_id,cohort_name)
VALUES
('student', 'Layla', 'Jones', 'l@gmail.com', '123456789', 1, 'london-class6'),
('student', 'Noor', 'Saleem', 'noor@gmail.com', '123456789', 1, 'london-class6'),
('student', 'Shahad', 'Fahad', 'shahad@hotmail.com', '123456789', 1, 'london-class5'),
('student', 'Sameer', 'Jama', 'smaeer@gmail.com', '123456789', 1, 'london-class5'),
('student', 'Hani', 'James', 'james@gmail.com', '123456789', 1, 'london-class5'),
('student', 'Ali', 'Shaheen', 'ali@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sara', 'Josh', 'sara@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sara', 'Jones', 'jones@gmail.com', '123456789', 1, 'london-class4'),
('student', 'Sahal', 'Rasheed', 'rasheed@gmail.com', '123456789', 3, 'scotland-class-4'),
('student', 'Khadar', 'Hassan', 'khadar@gmail.com', '123456789', 3, 'scotland-class-4'),
('student', 'Ibrahim', 'Saalah', 'ibrahim@gmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Sally', 'James', 'sally@hotmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Fakher', 'Noor', 'fakher@gmail.com', '123456789', 3, 'scotland-class-3'),
('student', 'Ned', 'Duncun', 'ned@gmail.com', '123456789', 3, 'scotland-class-1'),
('student', 'Hussien', 'Kamal', 'kamal@gmail.com', '123456789', 3, 'scotland-class-2'),
('student', 'Rahma', 'Fathi', 'rahma@gmail.com', '123456789', 4, 'west-midlands-class4'),
('student', 'David', 'Hewit', 'hewit@gmail.com', '12345', 4, 'west-midlands-class4'),
('student', 'Henarry', 'Camron', 'henarry@gmail.com', '123456789', 4, 'west-midlands-class4'),
('student', 'Rob', 'Obama', 'obama@gmail.com', '12345', 4, 'west-midlands-class3'),
('student', 'Sharron', 'Williams', 'sharron@gmail.com', '12345', 4, 'west-midlands-class2'),
('student', 'Nahla', 'Saeed', 'nahla@gmail.com', '12345', 7, 'medellin-class1'),
('student', 'Hamad', 'Kareem', 'hamad@gmail.com', '123', 7, 'medellin-class1'),
('student', 'Abrar', 'Nikk', 'abrar@gmail.com', '123', 6, 'rome-class1'),
('student', 'Ahamd', 'Raami', 'rami@gmail.com', '123', 5, 'capetown-class1');
INSERT INTO feedbacktable
(mentor_id,student_id,sent_date,title, body, response)
VALUES
(3, 2, '2020-10-18', 'test title', 'test body', 'test response');
INSERT INTO feedbacktable
(mentor_id,student_id,sent_date,title,body,response)
VALUES
(7, 6, '2020-10-19', 'good work', 'Ckecked your work, excellent work', 'Thank you mentor');
-- INSERT INTO feedbacktable
-- (mentor_id,student_id,sent_date,title,body,response)
-- VALUES
-- (8, 5, current_date, 'Review your classwork', 'Please review your class work to improve your understanding ', 'Will do');
-- INSERT INTO feedbacktable
-- (mentor_id, student_id,sent_date, title, body, response)
-- VALUES
-- (7, 67, current_date, 'new title', 'new body', 'new response');