Consider the following schema:


Offerings(Course, Semester)
Enrollment(StudId,Course,Semester)


Write a statement level trigger, which removes courses from Offerings for all those courses
whose enrollment falls below 10 students.


Solution:


CREATE TRIGGER WatchEnrollment
AFTER DELETE, INSERT, UPDATE ON Transcript
FOR EACH STATEMENT
DELETE FROM Offerings
WHERE EXISTS
( SELECT E.Course, E.Semester
FROM Enrollment E
WHERE E.Course = Course AND E.Semester = Semester
GROUP BY E.Course, E.Semester
HAVING count(E.StudId) < 10 )

Computer Science & Information Technology

You might also like to view...

A _____ line under a heading indicates subordinate text that is not displayed.

A. green B. blue C. gray D. red

Computer Science & Information Technology

After installation, how many days do you have to activate Windows 7?

A. 7 B. 30 C. 45 D. 60

Computer Science & Information Technology

To Display the Blank Form Tool, you click the Blank Form button in the:

A) Forms group on the Design tab. B) Forms group on the Create tab. C) Tools group on the Create tab. D) Tools group on the Design tab.

Computer Science & Information Technology

Detail sheets display and summarize totals from other worksheets

Indicate whether the statement is true or false

Computer Science & Information Technology