<small id='yDNXj'></small><noframes id='yDNXj'>

    <tfoot id='yDNXj'></tfoot>
    1. <legend id='yDNXj'><style id='yDNXj'><dir id='yDNXj'><q id='yDNXj'></q></dir></style></legend>

          <bdo id='yDNXj'></bdo><ul id='yDNXj'></ul>

      1. <i id='yDNXj'><tr id='yDNXj'><dt id='yDNXj'><q id='yDNXj'><span id='yDNXj'><b id='yDNXj'><form id='yDNXj'><ins id='yDNXj'></ins><ul id='yDNXj'></ul><sub id='yDNXj'></sub></form><legend id='yDNXj'></legend><bdo id='yDNXj'><pre id='yDNXj'><center id='yDNXj'></center></pre></bdo></b><th id='yDNXj'></th></span></q></dt></tr></i><div id='yDNXj'><tfoot id='yDNXj'></tfoot><dl id='yDNXj'><fieldset id='yDNXj'></fieldset></dl></div>
      2. 在 SQL Server 中定义一对一关系

        Defining a one-to-one relationship in SQL Server(在 SQL Server 中定义一对一关系)
            <bdo id='IEY72'></bdo><ul id='IEY72'></ul>

                  <tbody id='IEY72'></tbody>
                <legend id='IEY72'><style id='IEY72'><dir id='IEY72'><q id='IEY72'></q></dir></style></legend>

                <i id='IEY72'><tr id='IEY72'><dt id='IEY72'><q id='IEY72'><span id='IEY72'><b id='IEY72'><form id='IEY72'><ins id='IEY72'></ins><ul id='IEY72'></ul><sub id='IEY72'></sub></form><legend id='IEY72'></legend><bdo id='IEY72'><pre id='IEY72'><center id='IEY72'></center></pre></bdo></b><th id='IEY72'></th></span></q></dt></tr></i><div id='IEY72'><tfoot id='IEY72'></tfoot><dl id='IEY72'><fieldset id='IEY72'></fieldset></dl></div>
                <tfoot id='IEY72'></tfoot>
              1. <small id='IEY72'></small><noframes id='IEY72'>

                  本文介绍了在 SQL Server 中定义一对一关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要定义一对一的关系,但在 SQL Server 中似乎找不到正确的方法.

                  你问为什么是一对一的关系?

                  我使用 WCF 作为 DAL (Linq) 并且我有一个包含 BLOB 列的表.BLOB 几乎不会改变,每次进行查询时都将其传输过来会浪费带宽.

                  我查看了

                  创建表组织(ID int PRIMARY KEY,名称 varchar(200),地址 varchar(200),电话 varchar(12))走创建表客户(ID int PRIMARY KEY,AccountManager varchar(100))走ALTER TABLE 客户添加外键 (ID) 引用 组织 (ID)删除级联更新级联走

                  I need to define a one-to-one relationship, and can't seem to find the proper way of doing it in SQL Server.

                  Why a one-to-one relationship you ask?

                  I am using WCF as a DAL (Linq) and I have a table containing a BLOB column. The BLOB hardly ever changes and it would be a waste of bandwidth to transfer it across every time a query is made.

                  I had a look at this solution, and though it seems like a great idea, I can just see Linq having a little hissy fit when trying to implement this approach.

                  Any ideas?

                  解决方案

                  One-to-one is actually frequently used in super-type/subtype relationship. In the child table, the primary key also serves as the foreign key to the parent table. Here is an example:

                  CREATE TABLE Organization
                  ( 
                       ID       int PRIMARY KEY,
                       Name     varchar(200),
                       Address  varchar(200),
                       Phone    varchar(12)
                  )
                  GO
                  
                  CREATE TABLE Customer
                  ( 
                       ID              int PRIMARY KEY,
                       AccountManager  varchar(100)
                  )
                  GO
                  
                  ALTER TABLE Customer
                      ADD  FOREIGN KEY (ID) REFERENCES Organization(ID)
                          ON DELETE CASCADE
                          ON UPDATE CASCADE
                  GO
                  

                  这篇关于在 SQL Server 中定义一对一关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  sql group by versus distinct(sql group by 与不同)
                  How to return a incremental group number per group in SQL(如何在SQL中返回每个组的增量组号)
                  Count number of records returned by group by(统计分组返回的记录数)

                    <tfoot id='C08y9'></tfoot>

                      <legend id='C08y9'><style id='C08y9'><dir id='C08y9'><q id='C08y9'></q></dir></style></legend>

                    1. <small id='C08y9'></small><noframes id='C08y9'>

                            <tbody id='C08y9'></tbody>
                            <bdo id='C08y9'></bdo><ul id='C08y9'></ul>
                          • <i id='C08y9'><tr id='C08y9'><dt id='C08y9'><q id='C08y9'><span id='C08y9'><b id='C08y9'><form id='C08y9'><ins id='C08y9'></ins><ul id='C08y9'></ul><sub id='C08y9'></sub></form><legend id='C08y9'></legend><bdo id='C08y9'><pre id='C08y9'><center id='C08y9'></center></pre></bdo></b><th id='C08y9'></th></span></q></dt></tr></i><div id='C08y9'><tfoot id='C08y9'></tfoot><dl id='C08y9'><fieldset id='C08y9'></fieldset></dl></div>