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.
Table1 Record 1 Record 2 Record 3
Table2 Record 1 Record 2 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 Customer 1 Customer 2 Customer 3
Order Order 1 for Customer 1 Order 2 for Customer 1 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.
Student Student 1 Student 2 Student 3
Class Class 1 Class 2 Class 3
www