Cardinality in DBMS

Cardinality in DBMS

On this page, we will learn about Cardinality in DBMS and its concepts. Cardinality can be defined in two ways one in terms of SQL and another in terms of Data Models. Here we will learn about both.

Cardinality

  • In terms of SQL, Cardinality can be defined as the distinctiveness of data values stored in a column.
    • Higher the cardinality, more is the number of unique data in the columns.
    • Lower cardinality indicates there is a higher number of repeated values in the column.
  • In terms of Data Models, Cardinality also refers to the relationship between two tables. The Relationship between the tables can be as-
    • One-to-One.
    • One-to-Many.
    • Many-to-one.
    • Many-to-Many.
Cardinality in DBMS

Understanding the concept

  • Here we consider data values as shown in figure.
  • The figure shows a Relationship between an Employee and The Department he works in.
  • As learned previously there are two Entities here : Employee and Department
  • ‘Employee’ is related to ‘Department’ by the relationship ‘Works For’.
  • Now let us understand the concept of Cardinality here.
    • The relationship of D1 in Department to E1 and E2 in  Employee can be defined as One-to-Many.
    • Similarly, The Relationship of E3 in Employee to D2 in Department can be defined as One-to-One.
cardinality in DBMS image
Learn more about DBMS here on this page.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription