I was looking at database past exam from the school that I attend, and I have a question about ON DELETE and ON UPDATE.

The question in the past exam was:

Show the contents of the tables after the insturction update Student set sid=1234 where sid=4563 If on delete cascade was used on the reference from Enrollment to Student.

(Enrollment has an attribute referencing to the student relation)

So if on delete cascade was used, and if we were to update the student relation wouldn't this be rejected since it was on delete cascade, not on update cascade?

  • 1
    You MUST show full DDLs. And you MUST specify ONE DBMS - either SQL Server or MySQL. – Akina Oct 1 '19 at 5:07

if we were to update student relation wouldn't this be rejected

This is correct. If there is no ON UPDATE action defined in the foreign key reference, your update of referenced key would coflict with the foreign key constaint so it would be rejected.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.