开发者

How to use foreign keys in SQL Buddy?

开发者 https://www.devze.com 2023-04-09 19:50 出处:网络
I need to use foreign keys for update and cascade, etc. ALTER TABLE topics ADD FOREIGN KEY(topic_by) REFERENCES users(user_id)

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

ALTER TABLE topics
  ADD FOREIGN KEY(topic_by) REFERENCES users(user_id)
  ON DELETE RESTRICT开发者_StackOverflow中文版 ON UPDATE CASCADE;

but I am not able to make foreign keys in SQL Buddy.

Any way to do that?


did you try this :

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


Try this query:

ALTER TABLE topics
ADD CONSTRAINT topic_by
FOREIGN KEY (user_id) REFERENCES users(user_id);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号