-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTEST-SAMPLE.sql
More file actions
30 lines (25 loc) · 799 Bytes
/
Copy pathTEST-SAMPLE.sql
File metadata and controls
30 lines (25 loc) · 799 Bytes
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
--display information on all concerts
SELECT * FROM Events
WHERE category = 'Concert';
--display events on october 20, 2013
SELECT * FROM Events
WHERE date = '2013-10-20';
--display popular events after october 16
SELECT DISTINCT e.name, e.date, e.venue FROM Events AS e, Attending AS a
WHERE date >= '2013-10-16'
AND e.EID IN
(SELECT EID FROM Attending
WHERE Attending.confirmed=TRUE
GROUP BY EID
);
--display number of people attending each event
SELECT EID, Count(*) FROM Attending
WHERE Confirmed = TRUE
GROUP BY EID;
--display event search by keyword "Montreal"
SELECT * FROM Events
WHERE name LIKE '%Montreal%' OR venue LIKE '%Montreal%'
OR category LIKE '%Montreal%' OR additional_info LIKE '%Montreal%';
--display events that cost less than $15
SELECT * FROM Events
WHERE cost<=15;