forked from mikeygh2/CS430-APO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.sql
More file actions
60 lines (55 loc) · 1.57 KB
/
select.sql
File metadata and controls
60 lines (55 loc) · 1.57 KB
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
/*
Milestone 3
Written By:
Logan McCamon
Alan Waidmann
Mikey Hermann
*/
SELECT * FROM Address;
SELECT * FROM Event;
SELECT * FROM EventStatus;
SELECT * FROM EventType;
SELECT * FROM FamilyFlower;
SELECT * FROM Leader;
SELECT * FROM Major;
SELECT * FROM MajorRoster;
SELECT * FROM Minor;
SELECT * FROM MinorRoster;
SELECT * FROM Member;
SELECT * FROM NextWeek;
SELECT * FROM Occurrence;
SELECT * FROM Processed;
SELECT * FROM recorded_hours;
SELECT * FROM SchoolYear;
SELECT * FROM Shift;
SELECT * FROM Status;
SELECT * FROM Volunteer;
/*
* Sample select statement returning Member table and
* related data from Address, FamilyFlower, & Status tables.
*/
SELECT M.id,M.firstname,M.lastname,S.Name,F.Name,
A.homeaddress,A.citystatezip FROM Member AS M
JOIN FamilyFlower AS F ON M.Flower_Id = F.Flower_Id
JOIN Status AS S ON M.Status_Id = S.Status_Id
JOIN Address AS A ON A.M_Id = M.id;
/*
* Sample select statement from our Events/Shift/Occurrence
* tables. The Shift and NextWeek tables are structured
* similarily and additional queries are not shown.
*/
SELECT E.Name,E.DOW,ES.Name
FROM Occurrence AS O
JOIN Event AS E ON E.E_Id = O.E_Id
JOIN EventStatus AS ES ON ES.ES_Id = O.EventStatus_Id
WHERE O.startTime >= NOW();
/*
* Sample select statement displaying selecting Majors
* and minors based on the member id number
*/
SELECT M.id,M.firstname,M.lastname,Major.Name AS Major,Minor.Name AS Minor
FROM Member AS M
JOIN MajorRoster AS MR ON MR.M_Id=M.id
JOIN Major ON Major.Major_Id = MR.Major_Id
JOIN MinorRoster AS MiR ON MiR.M_Id=M.id
JOIN Minor ON Minor.Minor_Id = MiR.Minor_Id;