What is cardinality?
To understand this concept first need to know about relationship in database entities. When two or more table share Primary key and foreign key relationship that is a common column between them and with refrential integrity rule which tells the tables share dataset which can drilled down in both to get more shared information, can be termed as relationship between two tables.
From relationship one cannot know how many times the data can be fetched in the foreign key table, or how much data is available in the foreign key table with respect to the first table, all such information can be given or tells by cardinality between tables.
Cardinality basically tells the measure of participation of one table to second table.
For example let say there are two entities named employee and department, in such case if the business rule said the employee can take part into one department only so it states the cardinality from employee to department is (1,1).
But one department could hold several number of employee so cardinality from department to employees is (1,n).
Here n represent variable cardinality, in general for such case we assume a maximum limit like 1000 employee can be in one department for further uses.
Basically cardinality helps in several ways:-
1) can know the number of unique values in foreign key table .
2) high cardinality means table will grow faster.
3) low cardinality means table will have lesser records.
4) selection of index column can also be done.
Comments
Post a Comment