how to set foreign keys in mysql code example
Example 1: alter table add foreign key mysql
ALTER TABLE orders
ADD
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
Example 2: mysql foreign key constraints
ALTER TABLE Orders ADD CONSTRAINT FK_PersonOrder FOREIGN KEY (PersonID) REFERENCES Persons(PersonID);