Multiple Assignment- SQL
SQL supports multiple assignment to local variables and also applies multiple assignment semantics in SET clauses of UPDATE statements, but does not support multiple assignment in connection with updates on table targets. Thus, SQL has no counterpart to the theory book's Example, simultaneously deleting from both COURSE and IS_ENROLLED_ON. If we assume that there must be at least one enrolment for each course, and that students can enroll only on existing courses, deferred constraint checking has to be used, as shown in Example here.
Example: Withdrawing course C3 and deleting any enrolments on C3
Assume the definition of IS_ENROLLED_ON includes
CONSTRAINT Course_must_exist_for_enrolment
FOREIGN KEY (CourseId) REFERENCES COURSE ON DELETE NO ACTION
and the definition of COURSE includes
CONSTRAINT Enrolment_must_exist_for_course
CHECK ( CourseId IN (SELECT CourseId FROM IS_ENROLLED_ON)