开发者

How to use foreign keys in SQL Buddy?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜