Created
August 13, 2013 22:09
-
-
Save srkirkland/6226201 to your computer and use it in GitHub Desktop.
common student service queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT c.TermCode | |
, c.Crn | |
, c.Subject | |
, c.CourseNumb | |
, c.Sequence | |
, c.Name | |
, s.SectionType | |
, s.StartDate | |
, s.EndDate | |
, s.StartTime | |
, s.EndTime | |
, s.DaysOfWeek | |
FROM | |
vCourses c | |
INNER JOIN Sections s | |
ON c.TermCode = s.TermCode | |
AND c.Crn = s.Crn | |
WHERE | |
c.TermCode = '201303' | |
AND c.DepartmentId = 'MAT' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT c.TermCode | |
, c.Crn | |
, c.Subject | |
, c.CourseNumb | |
, c.Sequence | |
, c.Name | |
, s.SectionType | |
, s.StartDate | |
, s.EndDate | |
, s.StartTime | |
, s.EndTime | |
, s.DaysOfWeek | |
FROM | |
vCourses c | |
INNER JOIN Sections s | |
ON c.TermCode = s.TermCode | |
AND c.Crn = s.Crn | |
WHERE | |
c.TermCode = @Term | |
AND c.Subject = @Subject | |
AND c.CourseNumb in ({0}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select s.LoginId | |
,s.FirstName | |
,s.LastName | |
,s.Email | |
,r.Crn | |
from CourseRoster r | |
inner join vCourses c on (r.Crn = c.Crn AND r.TermCode = c.TermCode) | |
inner join students s on r.LoginId = s.LoginId | |
where | |
r.TermCode = @Term | |
AND c.Subject = @Subject | |
AND c.CourseNumb in ({0}) | |
select i.LoginId | |
,i.FirstName | |
,i.LastName | |
,i.Email | |
,c.Crn | |
from CourseInstructors ci | |
inner join vCourses c on (ci.Crn = c.Crn AND ci.TermCode = c.TermCode) | |
inner join Instructors i on ci.LoginId = i.LoginId | |
where | |
ci.TermCode = @Term | |
AND c.Subject = @Subject | |
AND c.CourseNumb in ({0}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- Regarding CoursesSubjectQuery.sql
/*
Missing Index Details from SQLQuery31.sql - clamps.StudentService (AESDEAN\taylor (51))
The Query Processor estimates that implementing the following index could improve the query cost by 54.7953%.
*/
/*
USE [StudentService]
GO
CREATE NONCLUSTERED INDEX [Sections_TermCode_CVIDX])
ON [dbo].[Sections] ([TermCode])
INCLUDE ([Crn],[SectionType],[StartDate],[EndDate],[StartTime],[EndTime],[DaysOfWeek])
GO
*/