如何在Mssql中的创建表语句中创建M到N的关系? [英] How Can I Create M To N Relationship Within A Create Table Statement In Mssql?

查看:118
本文介绍了如何在Mssql中的创建表语句中创建M到N的关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MSSQL的create table语句中创建多对多的关系?

请最早给我一个例子。

how can i create many to many relationship within a create table statement in MSSQL?
please give me an example at your earliest.

推荐答案

确切地说,您无法在单个表定义中正确定义多对多关系。通常,通过添加第三个结点表来解决多对多关系。这个表的目的是保存父表中各行之间所有连接的信息。



我建议阅读:

- 多对多(数据模型) [ ^ ]

- 心率(数据建模) [ ^ ]



如果对更多细节感兴趣,我建议阅读 CJ日期数据库系统简介 [ ^ ]
To be precise, you can't properly define many-to-many relationship inside a single table definition. Typically many-to-many relationship is solved by adding a third, a junction, table. The purpose of this table is to hold information about all the joins between individual rows in the parent tables.

I would suggest reading:
- Many-to-many (data model)[^]
- Cardinality (data modeling)[^]

And if interested in more details, I would recommend reading An Introduction to Database Systems by C.J. Date[^]


这篇关于如何在Mssql中的创建表语句中创建M到N的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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