- SQL Server 2014 Development Essentials
- Basit A. Masood Al Farooq
- 272字
- 2021-09-03 10:07:25
Relationships
Relationships identify associations between the data stored in different tables. Entities relate to other entities in a variety of ways. Table relationships come in several forms, listed as follows:
- A one-to-one relationship
- A one-to-many relationship
- A many-to-many relationship
A one-to-one relationship
A one-to-one relationship represents a relationship between entities in which one occurrence of data is related to one and only one occurrence of data in the related entity. For example, every employee should have a payroll record, but only one payroll record. Have a look at the following diagram to get a better understanding of one-to-one relationships:

A one-to-many relationship
A one-to-many relationship seems to be the most common relationship that exists in relational databases. In the one-to-many relationship, each occurrence of data in one entity is related to zero or more occurrences of data in a second entity. For example, each department in a Department
table can have one or more employees in the Employee
table. The following diagram will give you a better understanding of one-to-many relationships:

A many-to-many relationship
In a many-to-many relationship, each occurrence of data in one entity is related to zero or more occurrences of data in a second entity, and at the same time, each occurrence of the second entity is related to zero or more occurrences of data in the first entity. For example, one instructor teaches many classes, and one class is taught by many instructors, as shown in the following diagram:

A many-to-many relationship often causes problems in practical examples of normalized databases, and therefore, it is common to simply break many-to-many relationships in to a series of one-to-many relationships.
- PyTorch自動駕駛視覺感知算法實戰(zhàn)
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Java Web開發(fā)之道
- 編寫高質(zhì)量代碼:改善Python程序的91個建議
- DevOps入門與實踐
- Mastering LibGDX Game Development
- JavaScript by Example
- SAS數(shù)據(jù)統(tǒng)計分析與編程實踐
- 微信小程序全棧開發(fā)技術(shù)與實戰(zhàn)(微課版)
- Creating Mobile Apps with jQuery Mobile(Second Edition)
- 從零開始學(xué)C#
- .NET 4.5 Parallel Extensions Cookbook
- Apache Solr PHP Integration
- JavaScript Concurrency
- Vue.js 3.x高效前端開發(fā)(視頻教學(xué)版)