University Management System Solution
University Management System Solution
The University consists of a number of faculties, such as the Art Faculty, the Science Faculty,
and so on. Each faculty has a name, dean and building. A faculty may be divided into a
number of schools, for example, the Science Faculty has a School of Physics and a School
of Chemistry. Each school belongs to one faculty only and is located on just one campus,
but one campus maybe the location of many schools.
Every school has name and an building assigned to. Each school offers different programmes
and each programme can be offered by only one school. Each programme has a unique code,
title, level and duration. Each programme comprises several courses, different programmes
have different courses. Each course has a unique code and course title. Some courses may
have one or more prerequisite courses and one course can be the prerequisite course of some
other courses.
Each of the students is enrolled in a single programme of study which involves a fixed core
of courses specific to that programme as well as a number of electives taken from other
programmes. Students work on courses and are awarded a grade in any course if he/she
passes the course. Otherwise the student has to re-take the failed course. The system needs
to record the year and term in which the course was taken and the grade awarded to the
student. Every student has a unique ID. The system also keeps the student name, birthday
and the year he/she enrolled in the course.
The school employs lecturers to teach the students. A lecturer is allowed to work for one
school only. Each lecturer is assigned an ID which is unique across the whole university.
The system keeps the lecturer’s name, title and the office room. A supervisor maybe in
charge of several lecturers, but a lecturer, however reports to only one supervisor. A lecturer
can teach many different courses. A course may also have been taught by many different
lecturers.
The university is operated by committees. Each faculty has to have a number of committees
with the same titles across the university, such as the Faculty Executive, the Post Graduate
Studies Committee, the Health and Sanity Committee, and so on. The committees meet
regularly, such as weekly or monthly. The frequency is determined by the faculty involved.
A committee’s members are all lecturers. A lecturer may be a member of several committees.
Task1
Query 1: List all the schools are located in 'Toronto Campus', and sort them by school
name.
Query 3: Give all the names of the lecturers who are the members of the committee and
sort by their name.
Query 4: List all supervisor's name and the name of the lecturer they manage. Please sort
by supervisor name and lecturer name.
Query 5: Give all the lecturers who are not the member of the committee.
SELECT STFID AS
STAFF_ID FROM LECTURER
WHERE STFID NOT IN (SELECT DISTINCT STFID FROM COMMITTEE_LECTURER)
Query 7: Give all the lecturers with the courses they are teaching. Sort by lecturer name.
SELECT L.LECTNM AS LECTURER_NAME,C.CRSETITL AS
COURSE_TITLE FROM LECTURER_COURSE LC
INNER JOIN LECTURER L ON LC.STFID = L.STFID
INNER JOIN COURSE C ON LC.CRSECD = C.CRSECD
ORDER BY L.LECTNM
Query 8: Give all the course titles and their corresponding prerequisite course titles.
SELECT C1.CRSETITL AS COURSE_TITLE,C2.CRSETITL AS
PRE_COURSE_TITLE FROM PRE_COURSE PC
INNER JOIN COURSE C1 ON PC.CRSECD = C1.CRSECD
INNER JOIN COURSE C2 ON PC.PRECRSECD =
C2.CRSECD
Query 9: Give the top 5 courses which have more students involved.
SELECT C.CRSECD AS COURSE_CODE,COUNT(SS.STUID) AS
NUMBER_OF_STUDENTS FROM COURSE_STUDENT SS
LEFT JOIN COURSE S ON SS.SUBJCD = S.SUBJCD
LEFT JOIN COURSE C ON S.CRSECD = C.CRSECD
GROUP BY C.CRSECD
ORDER BY NUMBER_OF_STUDENTS
DESC FETCH FIRST 5 ROWS ONLY
Query 10: Give any of the prerequisite courses was not took by any of the students
who enrolled into the university in 2010, and were taking the courses in
2011.