一个表中的多个外键到mysql中的另外一个表 [英] Multiple foreign keys in one table to one other table in mysql
本文介绍了一个表中的多个外键到mysql中的另外一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要监视呼叫在我的应用程序。上面的3字段实际上是userid数字。
现在我想知道,我可以在table用户中使这些id字段的3个字段外键元素吗?
只要定义所有三个外键来引用 id
User
。
I got two tables in my database: user and call. User exists of 3 fields: id, name, number and call : id, 'source', 'destination', 'referred', date.
I need to monitor calls in my app. The 3 ' ' fields above are actually userid numbers.
Now I'm wondering, can I make those 3 field foreign key elements of the id-field in table user?
解决方案
Yes - you can ;-)
Just define all three foreign keys to refer to the id
column in User
.
这篇关于一个表中的多个外键到mysql中的另外一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文