Specifying the cardinality of a join
You can specify the right-to-left and left-to-right cardinality of a join. Table 6‑10 lists the cardinality types and a description of each type.
Table 6‑10 Cardinality types
Cardinality type
Description
1
One record in the first table matches one record in the second table.
?
One record in the first table matches zero or one record in the second table.
*
One record in the first table matches zero or more records in the second table.
+
One record in the first table matches one or more records in the second table.
The right-to-left cardinality type is followed by a hyphen (-), and then by the left‑to‑right cardinality type. The cardinality type depends on the join column.
For example:
Customers JOIN Orders ON (Customers.custid = Orders.custid)
{CARDINALITY ('1-+')}
indicates that:
*One record in Orders matches one record in Customers.
*One record in Customers matches one or more records in Orders:
Customers JOIN Orders ON (Customers.custid = Orders.custid)
{CARDINALITY ('1-*')}
indicates that:
*One record in Orders matches one record in Customers.
*One record in Customers matches zero or more records in Orders:
Customers JOIN Orders ON (Customers.custid = Orders.custid)
{CARDINALITY ('*-?')}
indicates that:
*One record in Orders matches zero or more records in Customers.
*One record in Customers matches zero or one record in Orders.