Cardinality is a very important concept in database design. Many different types of cardinality exist, and need to be used correctly to properly design database. Cardinalities are used when we are creating an E/R diagram, and show the relationships between entities/ tables. The first type of cardinality is a very basic 1:1 (one to one). This is where we might have one race car driver for every race car. The second type of cardinality is a 1:M (one to many). Here we could say that one race car has many mechanics. The third type of cardinality is a M:N (many to many). Here we could say that many mechanics work on many cars. But with a M:N relationship it is more realistic to turn it into two 1:M relationships. we can accomplish this by adding an extra table in between mechanic and car named “works on”. These are sometime referred to as dummy tables. we would say that each mechanic works on a car and each car is worked on by a mechanic. The last type of cardinality is a M:N:M (many to many to many). This is only used in a subtype/super type situation. This is a hieratical type model and the primary key must be found in all of the attributes starting from the very top all the way to the bottom. Here we could start with a super type of person and then move down to sub types of racers and mechanics, and then subtype of those could be pro and amateur. All with the key of race team being included in all of their attributes.
Pages in category "Cardinality"
This category contains only the following page.