I'm trying to read about how to use FOREIGN KEYS
in MySQL. I see in many places that they have ON DELETE
and ON UPDATE
.
What's the difference between them? What exactly do they do?
Here is a small example of my database:
class
------
classId
profId //Refers to a specific profId from professor table
courseId //Refers to a specific courseId from course table
semId //Refers to a specific semId from semester table
professor
---------
profId
first
last
course
------
courseId
department
number
title
semester
--------
semId
season
year
Also, a side note, which would be referred to as the FOREIGN KEY
, the index id in the individual tables or the id's in the class table?