Could somebody explain to me, with the help of examples, what is cardinality in databases?
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).