How to use foreign keys in SQL Buddy?

I need to use foreign keys for updating and cascade, etc.

ALTER TABLE topics ADD FOREIGN KEY(topic_by) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE; 

but I cannot create foreign keys in SQL Buddy.

How to do it?

+6
source share
1 answer

Have you tried this:

 ALTER TABLE topics ADD CONSTRAINT topic_by FOREIGN KEY(user) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE 
0
source

Source: https://habr.com/ru/post/898356/


All Articles