I have been searching all over the internet but I couldn't seem to find an answer that I can understand.
So kindly, if somebody could explain to me with the help of examples what is cardinality in databases?
This question is tagged with
~ Asked on 2012-05-16 14:49:07
A source of confusion may be the use of the word in two different contexts - data modelling and database query optimization.
In data modelling terms, cardinality is how one table relates to another.
There are also optional participation conditions to the above (where a row in one table doesn't have to relate to the other table at all).
See Wikipedia on Cardinality (data modelling).
When talking about database query optimization, cardinality refers to the data in a column of a table, specifically how many unique values are in it. This statistic helps with planning queries and optimizing the execution plans.
See Wikipedia on Cardinality (SQL statements).
~ Answered on 2012-05-16 14:51:57
It depends a bit on context. Cardinality means the number of something but it gets used in a variety of contexts.
PERSONtable, for example,
GENDERis likely to be a very low cardinality column (there are probably only two values in
PERSON_IDis likely to be a very high cardinality column (every row will have a different value).
There are probably other situations where people talk about cardinality using a different context and mean something else.
~ Answered on 2012-05-16 14:58:09