Question 9:
Create a trigger named Tr_insert_enrollment for the insert statement on the 'enrollment'table so that when we call an insert statement to insert one or more enrollments into the 'enrollment' table, after inserting the corresponding rows into the 'enrollment' table, the system will automatically insert into the 'marks' table the rows with mark = NULL for all the assessments of the courses corresponding to the inserted enrollments.
8 of 8
Paper No: 6
For example, as the course with courseld = 11 has two assessments with Id=56 and Id=57,and the course with coursed = 1 has 8 assessments with Id from 11 to 18, when you execute the following statement for inserting two enrollments with the courseld = 11 and coursed = 1,the system will automatically insert into the 'marks' table 10 rows as in the following figure:
insert into enrollment (enrollmentid, studentld, courseld, semesterld)
values (600,9,11,4),
(601,10,1,5)
+ 100%
Zoom
Close