In MySQL I have two tables
roles
role_id | role_name
user_roles
user_id | role_id
in user_roles table role_id is a FOREIGN KEY. Now I want to restrict on deletion of row in roles table if role_id is also exists on user_roles table
I think this could be done either from Integrity setting while creating table. I don't know what does CASCADE or RESTRICT do and how they works.
I read somewhere that FOREIGN KEY does not supported by Storage Engine MyISAM so please guide me for both Storage Engine (MyISAM and InnoDB)