Professional Documents
Culture Documents
Assignment 1 - 2018
Assignment 1 - 2018
Consider the schema R over the attributes KNLMDFG with the following functional
dependencies:
KN → L
LM → N
LMN → D
D→M
M → FG
Question 2 [4 marks]
Write a statement level trigger, which removes courses from OFFERINGS for all those courses
whose enrollment falls below 10 students. Note that the trigger must happen after delete, insert,
and update.
Question 3 [8 marks]
Student (Id, Name, Country)
Course (CrsCode, CrsName, Type, Instructor)
Results (Id, CrsCode, Grade)
All the key fields are underlined. The Type field specifies the course type, e.g. MATH, STAT,
SYSC, TTMG, ELEC, etc. The Results relation lists the grade that students (in Student relation)
obtain for courses (in Course relation). Write the following queries in (i) relational algebra and
(ii) SQL.
a. Find the Id of students who take TTMG or SYSC course.
b. Find the Id of students who take every course.