tailieunhanh - Microsoft ADO .NET 4 Step by Step - p 11
Thiết lập mối quan hệ giữa các bảng Trước khi tập trung vào các tính năng mối quan hệ của lớp DataSet, nó là cần thiết để có một sự hiểu biết rõ ràng về những gì nó có nghĩa là cho hai bảng có liên quan. | 76 Microsoft 4 Step by Step Establishing Relationships Between Tables Before focusing on the relationship features of the DataSet class it is essential to have a clear understanding of what it means for two tables to be related. Understanding Table Relations In relational database modeling the term cardinality describes the type of relationship that two tables have. There are three main types of database model cardinality One-to-One A record in one table matches exactly one record in another table. This is commonly used to break a table with a large number of columns into two distinct tables for processing convenience. Tablel Table2 Record 1 Record 1 Record 2 Record 2 Record 3 Record 3 One-to-Many One record in a parent table has zero or more child records in another table. A typical use for the one-to-many relationship is in an ordering system in which a single customer record the parent will have none one or many order records the children on file. Likewise a single order record will have multiple order line items. One-to-many relationships are the most common type of table link in relational databases. Customer Order Customer 1 Order 1 for Customer 1 Customer 2 Order 2 for Customer 1 Customer 3 Order 1 for Customer 2 Many-to-Many In this third and most complex type of link one record in the first table is associated with zero or more records in the second table and each record in the second table can also be associated with zero or more records in the first table. Students taking classes is a typical real-world example of a many-to-many relationship. Each student can take multiple classes and each class can have multiple students listed as class participants. Chapter 5 Bringing Related Data Together 77 Student Class Student 1 Class 1 Student 2 Class 2 Student 3 Class 3 Fortunately all three of these model relationships share a common physical implementation concept the foreign key the use of a table s identifying column s by another table. In a .
đang nạp các trang xem trước