-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview3.sql
More file actions
26 lines (25 loc) · 1.29 KB
/
view3.sql
File metadata and controls
26 lines (25 loc) · 1.29 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
-- create a view to get the course time table which includes
-- instructor name, CourseName, Building, ClassRoom, Daily Schedule
-- like dayofweek, start and end times
-- Run the below Query to drop the view
-- DROP VIEW CourseTimeTableWithScheduleInfo
-- Run the below Statement to Check the output
-- SELECT * FROM CourseTimeTableWithScheduleInfo
CREATE VIEW CourseTimeTableWithScheduleInfo AS
SELECT P.FirstName+' '+P.LastName AS Instructor,
CC.CourseCode+ ' '+ CAST(CC.CourseNumber AS VARCHAR(10)) AS CourseName,
B.BuildingName, CR.RoomNumber, ST.SemesterText, DOW.Text AS DayofWeekInfo,
CDS.StartTime, CDS.EndTime
FROM TeachingAssignment TA, CourseSchedule CS, CourseDailySchedule CDS,
EmployeeInfo EI, People P, CourseCatalogue CC, ClassRoom CR,
SemesterInfo SI, SemesterText ST, Buildings B, DayOfWeekInfo DOW
WHERE TA.EmployeeID = EI.EmployeeID AND
P.PersonID = EI.PersonID AND
CS.CourseScheduleID = TA.CourseScheduleID AND
CC.ID = CS.CourseID AND
CDS.CourseID = CS.CourseScheduleID AND
CR.ClassRoomID = CS.Location AND
CS.Semester = SI.SemesterID AND
SI.Semester = ST.SemesterTextID AND
B.ID = CR.Building AND
CDS.DayofWeekID = DOW.ID