外键和引用键有什么区别? [英] What is difference between foreign key and reference key?
本文介绍了外键和引用键有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请大家解决它。
解决方案
我假设你正在讨论使用 REFERENCES
where FOREIGN KEY
关键字不被使用,例如。
author_id INTEGER REFERENCES作者(id)
...而不是...
author_id INTEGER,
FOREIGN KEY(author_id)REFERENCES作者(id)
答案是,它只是同一事物的简写语法。两者之间的主要关切应该是可读性的。
I am very confused between these two. Are they same or different? Some books or people says they are same and others says they are different. I tried but not find any authentic answer.
Please guys solve it.
解决方案
I am supposing that you are talking about using the REFERENCES
where the FOREIGN KEY
keyword is not used, eg.
author_id INTEGER REFERENCES author(id)
... instead of ...
author_id INTEGER,
FOREIGN KEY(author_id) REFERENCES author(id)
The answer is, that it is simply shorthand syntax for the same thing. The main concern when altering between the two should be readability.
这篇关于外键和引用键有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文