Syllabus Detail
- Cardinality in an RDBMS. 12 ATAR
What is Cardinality in RDBMS?
- A relational database management system must have database tables that relate in some way
- Cardinality refers to the way that one database table relates to another
- When planning databases or systems with ER Diagrams, we use cardinality notation to solve relationships
- There are three different types of cardinality; one-to-one, one-to-many and many-to-many
- We often practice normalisation in order to resolve many-to-many cardinality relationships
Cardinality relationships:
- One-to-one (1:1)
- This occurs when two database tables directly relate to eachother
- For example, if we have two tables; Drivers and Cars
- In our database, only one driver may have one car at any time
- Hence the relationship remains 1 (driver) : (drives) : 1 (car)
- see here for why have a 1:1 relationship setup for security reasons
- these are not very common
- One-to-many (1:M)
- This occurs when a table relates to many other tables in a database
- For example, if we have two tables; Students and Assignments
- In our database, one student can have submitted many assignments, but each one assignment is submitted by one student
- Hence, the relationship remains 1 (student) : (submits) : M (assignments)
- these are most common in an RDBMS
- Many-to-many (M:N)
- This occurs when many tables relate to many other tables in a database
- This is virtually unachievable, hence why we use the process of normalisation to resolve many-to-many relationships
- Read more about Normalisation by The Computing Teacher here
Further Research
Worksheet and Practice (yet to be added)
Found an error or have an enhancement? Please let us know via this contact form