Cardinality in generated queries
In 0:1
, 0
is the minimum cardinality,
1
is the maximum cardinality.
In 1:n
, 1
is
the minimum cardinality, n
is the maximum cardinality.
A relationship with
cardinality specified as 1:1
to 1:n
is commonly referred to as
1
to n
when focusing on the maximum cardinalities.
A
minimum cardinality of 0
indicates that the relationship is optional. You specify a
minimum cardinality of 0
if you want the query to retain the information on the
other side of the relationship in the absence of a match. For example, a relationship between
customer and actual sales may be specified as 1:1
to 0:n
. This
indicates that reports will show the requested customer information even though there may not be any
sales data present.
Therefore a 1
to n
relationship can also
be specified as:
-
0:1
to0:n
-
0:1
to1:n
-
1:1
to0:n
-
1:1
to1:n
Use the Relationship impact statement in the Relationship
Definition dialog box to help you understand cardinality. For example, Sales Staff
(1:1
) is joined to Orders (0:n
).
It is important to ensure that the cardinality is correctly captured in the model because it determines the detection of fact query subjects and it is used to avoid double-counting factual data.
When generating queries, IBM Cognos software follows these basic rules to apply cardinality:
- Cardinality is applied in the context of a query.
-
1
ton
cardinality implies fact data on then
side and implies dimension data on the1
side. - A query subject may behave as a fact query subject or as a dimensional query subject, depending on the relationships that are required to answer a particular query.
Use the Model Advisor to see an assessment of the behavior implied by cardinality in your model.
For more information, see Single Fact Query and Multiple-fact, Multiple-grain Query on Conformed Dimensions.