What is cardinality in databases?
Cardinality refers to the number of distinct values in a column, or the nature of a relationship between two tables (one-to-one, one-to-many, many-to-many). High-cardinality columns have many unique values (like email); relationship cardinality describes how rows in one table map to rows in another.
Cardinality has two related meanings in data work.
Column cardinality is how many distinct values a column holds. An email or order-id column is high-cardinality (nearly all unique); a boolean or status column is low-cardinality. It affects indexing, storage and how you should visualise a field.
Relationship cardinality describes how tables relate:
- One-to-one each row matches at most one row in the other table.
- One-to-many one customer, many orders.
- Many-to-many students and courses, usually via a bridging table.
Getting relationship cardinality wrong is a classic cause of inflated totals, a many-to-many join can silently multiply rows and double-count a measure.
iDBQuery guards against exactly this. When it infers joins from your schema, it accounts for the cardinality of the relationships so aggregates are not accidentally fanned out and double-counted. And because it cites every figure back to its source rows, you can verify a total is built from the right number of records. So whether you are joining a high-cardinality key or navigating a many-to-many relationship, iDBQuery writes the query correctly and shows its working.
Updated 2026-06-22