-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview1.sql
More file actions
28 lines (25 loc) · 1.05 KB
/
view1.sql
File metadata and controls
28 lines (25 loc) · 1.05 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
-- Creates a view to get the list of all the students
-- who have failed in the courses in current Year 2016
-- Run the below Query to drop the view
-- DROP VIEW StudentsOnProbation
-- Run the below Statement to Check the output
-- SELECT * FROM StudentsOnProbation
CREATE VIEW StudentsOnProbation AS
SELECT p.FirstName, p.LastName, cc.CourseCode, cc.CourseNumber, sgs.StudentStatus, st.SemesterText, si.YearInfo
FROM StudentCourseEnrollment sc
INNER JOIN StudentInfo s ON
sc.StudentID = s.StudentID
INNER JOIN CourseSchedule cs ON
cs.CourseScheduleID = sc.CourseID
INNER JOIN CourseCatalogue cc ON
cs.CourseID = cc.ID
INNER JOIN StudentGradingStatus sgs ON
sgs.StudentStatusId = sc.StatusID
INNER JOIN People p ON
p.PersonID = s.PersonID
INNER JOIN SemesterInfo si ON
si.SemesterID = cs.Semester
INNER JOIN SemesterText st ON
si.Semester = st.SemesterTextID
WHERE sgs.StudentStatus IN ('Fail')
AND si.YearInfo IN (2016);