You are on page 1of 3

PROG8080 Database Management

Fall 2022 Assignment 2


Use the SIS database to answer the following questions:
# Question Table(s) Marks
Assignment 2 (A2) requirements.
(a) Before you begin A2, complete section A (Joins) and section B (Aggregate
Functions) of PROG8080 Individual Exercise 3.
(b) Use the same SQL Coding Rules specified in PROG8080 Assignment 1.

(c) You must use JOINs (either implicit or explicit syntax) in A2. Do not use
subqueries in A2. There will be a one point deduction per violation.

Joins
1. List the courses for the program code ‘0066C’. Include the school code, Program, 4
program code, course number and semester in the result. Order the ProgramCourse
result by the semester and course number.
course code

schoolCode code courseNumber semester


---------- ----- ------------ -----------
EIT 0066C CDEV1020 1
EIT 0066C INFO1030 1
EIT 0066C INFO1570 1
EIT 0066C INFO8000 1
EIT 0066C PROG8080 1
EIT 0066C PROG8090 1
EIT 0066C INFO2080 2
EIT 0066C INFO8105 2
EIT 0066C PROG1800 2
EIT 0066C PROG2230 2

2. List the required course prerequisites for COMP2280. Include the course Course, 4
code, prereq and prereq course names in the result. Order the result by CoursePrerequisiteAnd
the prerequisite course code in descending order. Use the implicit join
syntax.

Course Code Prereq Prereq Course Name


----------- -------- -----------------------------------------------
COMP2280 MGMT2050 ITSS Project Management
COMP2280 INFO1570 Technology Infrastructure: Fundamentals
COMP2280 COMP2160 Application Software
COMP2280 COMP2050 Applied SQL

3. List the persons from the Person table who are not students. Show the Person, 5
person’s number, first name, last name, and city. Use LEFT OUTER JOIN. Student
Order the results by the person’s last name.
Number of rows expected: 14

4. List the lab software installed on machines in room 2A205. List each LabSoftware, 5
software package’s unique identifier along with the software product’s Room,
name. Order the result by software product name. Use the explicit join Software
syntax.
Number of rows expected: 20

5. Show Employee e1.number aliased as ‘Employee’ and Employee Employee 6


e1.reportsTo aliased as ‘Supervisor’ and Employee e2.reportsTo aliased
as ‘Supervisor Reports To’. Order the results by e1.reportsTo. Do left
outer self-join (e1.reportsTo = e2.number).
Employee Supervisor Supervisor Reports To
-------- ---------- ---------------------
4427732 NULL NULL
6434468 NULL NULL
6860242 NULL NULL
8436780 NULL NULL
7572373 4427732 NULL
8135170 4427732 NULL
2117745 4427732 NULL
3214350 4427732 NULL
3455730 4427732 NULL
3514239 4427732 NULL
3566163 4427732 NULL
8383259 6434468 NULL
5512736 6860242 NULL
6886352 8436780 NULL

Aggregate Functions
6. Show CourseOffering courseNumber, CourseStudent minimum CourseOffering, 6
finalMark aliased as ‘Lowest Mark’, CourseStudent average finalMark CourseStudent
aliased as ‘Average Mark’ and CourseStudent maximum finalMark
aliased as ‘Highest Mark’ for the Winter 2010 session grouped by
courseNumber. Report all grades as whole numbers.

Course Lowest Mark Average Mark Highest Mark


-------- ---------------------- ---------------------- --------------
INFO2080 63 77 83
INFO8105 75 85 94
PROG1800 70 84 94
PROG2230 51 68 82

7. List the number of courses taught by employees in the School of Person, Employee, 7
Engineering and IT (EIT), for those courses offered in any semester of CourseOffering
2008 or 2009. Include in the result the employee number, “user id” in
caps (i.e., first three letters of last name and last 3 characters of
employee number), along with the count of the number of courses that
they taught, aliased with “# Courses Taught”. Order the result by “user
id”. Use only inner joins (explicit syntax).

Employee User ID # Courses Taught


-------- ------- ----------------
7572373 HUH373 3
3455730 KAR730 2
3566163 KAT163 2
3514239 WEK239 3
8135170 WHE170 3
2117745 YUR745 3

8. Produce a list of all of the co-op programs and the total tuition for those Program, 7
programs over all semesters. As these amounts are for co-op programs, ProgramFee
the base tuition amount must be increased by the corresponding co-op
multiplier for each specific program. Output the program acronym and
program name in the result, along with the total tuition (i.e., Total Fees).
Use FORMAT() to display the Total Fees in dollars and cents.

Hint: the Computer Programmer (CP) program is not a co-op program.

Program Program Name Total Fees


------- -------------------------------------------------- -----------
CAD Computer Applications Development (Coop) $6,760.00
CPA Computer Programmer/Analyst (Coop) $9,632.00
ITSS Information Technology Support Services (Coop) $7,248.00
ITID IT Innovation and Design (Coop) $9,642.56
9. List the students who have made payments, by cheque or cash only. Person, 6
Include the student number, last name, first name and total payment Payment,
amount in your answer. Only display students with total payment PaymentMethod
amount of at least $10,000.00. Order the result by total payment
amount in descending order. Use a join to produce the result.

Student Number Last Name First Name Total Payment Amount


-------------- -------------- -------------- ---------------------
2642726 BICKERS SANDRA 13159.00
3868247 KALINOWSKI MELINDA 13159.00
1335314 NOLAN JOSEPH 10000.00

50

You might also like