如何在 Microsoft SQL Server Management Studio 2008 中设置引用完整性规则
我是 Management Studio 的新手。我在这两个表之间建立了关系,但是如何在它们上设置完整性规则,例如多对一或多对多?
表格 http://www.imageupload.org/thumb/thumb_98396.png
http://www.imageupload.org/?d=5862C4631 这里是图片的下载链接。
I am new with Management Studio. I built relation between these two tables, but how to set integrity rules on them, like many-to-one, or many-to-many?
tables http://www.imageupload.org/thumb/thumb_98396.png
http://www.imageupload.org/?d=5862C4631 here is download link for pictre.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您创建列之间的链接时,出现的关系对话框将允许您指定哪个表是主键表,哪个表是外键表。主键表是“一”,外键表是“多”。
在您提供的图中,“钥匙”图标显示哪一侧是“一”,而无穷大图标显示哪一侧是“多”
我认为您不能直接在两个表之间创建多对多关系。为此,您必须创建一个位于两个相关表之间的中间表。
When you create the link between columns, the relationship dialog that appears will allow you to specify which table is the Primary key table and which is the foreign key table. The primary key table is the "One" the foreign key table is the "Many".
In the diagram you provided, the Key icon shows which side is the "One" while the infinity icon shows which side is the "Many"
I don't think you can create a many-to-many relationship directly between two tables. In order to do that you have to create an intermediate table that sits between the two related tables.