Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要使用外键进行更新和级联等。
ALTER TABLE topics ADD FOREIGN KEY(topic_by) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE;
但我无法在 SQL Buddy 中创建外键。
有什么办法吗?
你试过这个吗:
ALTER TABLE topics ADD CONSTRAINT topic_by FOREIGN KEY(user) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE
试试这个查询:
ALTER TABLE topics ADD CONSTRAINT topic_by FOREIGN KEY (user_id) REFERENCES users(user_id);