Setting up table relations what do “Cascade”, “Set Null” and “Restrict” do?
I want to start using table relations in a new project. After some googling I got 2 tables set up as InnoDB: The keys I want to link are ->users->userid (primary) ->sessions->userid (index) The only thing that I don't understand in this process is what the different settings for "On update" and "On delete" do The options here are: -- (nothing?) Cascade (???) Set Null (sets everything to null?) No action (well duh...) Restrict (???) I basically want the data in sessions to be deleted when a user is completely deleted This since the sessions will only be deleted when the expiration is detected