我如何使用外键 [英] How I use Foreign Key

查看:106
本文介绍了我如何使用外键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







有人请告诉我如何使用外键

Hi


Somebody please tell me how i use foreign key

推荐答案

有关您问题的所有信息...

http:// www.1keydata.com/sql/sql-foreign-key.html [ ^ ]
all information regarding your question ...
http://www.1keydata.com/sql/sql-foreign-key.html[^]


如何使用?通常......建立桌子之间的关系。



见这个:

http://www.w3schools.com/sql/sql_foreignkey.asp [ ^ ]

创建外键关系 [ ^ ]
How to use? Normally... to build relationship between tables.

See this:
http://www.w3schools.com/sql/sql_foreignkey.asp[^]
Create Foreign Key Relationships[^]


在2表,主表和从表之间创建关系时。您使用外键作为字段来创建关系。



在您的代码中(来自您的评论)很明显,整数ID将是一个FOREIGN KEY。正如 Microsoft SQL Server文档 [ ^ ]说,



When you create a relationship between 2 table, a master and a slave table. You use a foreign key to be used as a field to create the relationship on.

In your code (from your comment) it is clear that the ID that integer, would be a FOREIGN KEY. As Microsoft SQL Server documentation[^] says,

Quote:

外键(FK)是一列或列的组合,用于在两个表中的数据之间建立和实施链接。您可以在创建或修改表时通过定义FOREIGN KEY约束来创建外键。

A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables. You can create a foreign key by defining a FOREIGN KEY constraint when you create or modify a table.





阅读附加链接,它有更多信息本章,你会在那里找到更多细节。



谢谢。



Read the attached link, it has more information on this chapter and you will find more details to it there.

Thanks.


这篇关于我如何使用外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆