Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Meaning of Cardinality
(Explanation)
Cardinalities indicate how many instances of one entity can be linked
to one specific instance of another entity.
Cardinalities are often expressed as a pair of numbers.
The first number is the minimum, and the second number is the
maximum.
(3rd Slide)
The minimum cardinality of a relationship indicates whether each row
in that entity MUST be linked to a row in the entity on the other side of
the relationship.
Minimum cardinalities can be either 0 or 1.
A minimum cardinality of zero means that a new row can be added to
that table without being linked to any rows in the other table.
A minimum cardinality of 1 means that each row in that table MUST be
linked to at least one row in the other table
(4th Slide)
The minimum cardinality of zero in the (0, N) cardinality pair to the left
of the customer entity in the customer-sales relationship indicates that
a new customer may be added to the database without being linked to
any sales events.
The minimum cardinality of 1 in the (1, 1) cardinality pair to the right of
the sales entity in the customer-sales relationship indicates that a new
sales transaction CAN ONLY be added if it is linked to a customer.
(5th Slide)
The maximum cardinality of a relationship indicates whether each row
in that entity CAN be linked to more than one row in the entity on the
other side of the relationship.
Maximum cardinalities can be either 1 or N.
(6th Slide)
The maximum cardinality of N in the (0, N) cardinality pair to the left of
the customer entity in the customer-sales relationship indicates that a
given customer MAY be linked to many sales events.
The maximum cardinality of 1 in the (1, 1) cardinality pair to the right
of the sales entity in the customer-sales relationship indicates that a
given sales transaction can only be linked to one customer.
(7th Slide)
(8th Slide)
(9th Slide)
in events.
(10th Slide)
1. A typical transaction involves the
customer first contacting the customer
services department to verify
availability and check the price of the
item or items being sought.
2. If the customer decides to buy, he or she
is transferred to a sales agent, who takes
the order.
3. The shipping clerk sends the products to
the customer by a common carrier.
4. The billing clerk records the sale in the
sales journal, prepares an invoice, and
sends it to the customer, who is given 30
days to make payment.
5. The AR clerk also receives a copy of the invoice and records it in the AR ledger.
Subsequently (within 30 days) the customer sends a check and the remittance
advice to Apex.
6. The cash receipts clerk receives the check, records it in the cash receipts journal,
and updates the cash account.
7. The remittance advice goes to the AR clerk, who updates (reduces) the
customers account receivable.
8.
(11th Slide)
(12th Slide)
(13th Slide)
(14th Slide)
(21st Slide)
(22nd Slide)
(23rd Slide)
(24th Slide)
FIGURE
10-8
(1:1)
(1:M)
(M:M)
EXAMPLE 1 (1:1). Assume that a company has 1,000 employees but only 100 of them are sales staff. Assume also
that each salesperson is assigned a company car, but nonsales staff are not. Example 1 in Figure 9-11 shows that for
every occurrence (record) in the Employee entity, there is a possibility of zero or one occurrence in the Company
Car entity.
When determining the cardinality values in an entity association, select a single occurrence (record) of one entity
and answer the following question: What are the minimum and maximum number of records that may be associated
with the single record that has been selected? For example, selecting an Employee entity record and looking toward
the Company Car entity, we see two possible values. If the selected Employee record is that of a salesperson, then
he or she is assigned one (and only one) company car. This particular Employee record, therefore, is associated with
only one record in the Company Car entity. If, however, the selected Employee record is that of a nonsalesperson,
then the individual would be assigned no (zero) car. The Employee record in this case is associated with zero
Company Car records. Thus, the minimum cardinality is zero and the maximum cardinality is one. A circle and a
short line intersecting the line connecting the two entities depict this degree of cardinality. Notice that from the
Employee entity perspective, the cardinality is shown at the Company Car end of the association line. Now select a
Company Car record and look back at the Employee entity. Because each company car is assigned to only one
employee, both the minimum and maximum number of associated records is one. Two short intersecting lines at the
Employee end of the association line signify this cardinality.
EXAMPLE 2 (1:1). Example 2 illustrates a situation in which each record in one entity is always associated with
one (and only one) record in the associated entity. In this case, each company laptop computer is assigned to only
one manager, and every manager is assigned only one computer. Two short lines intersecting the connecting line at
both ends depict this cardinality.
EXAMPLE 3 (1:M). Example 3 presents the relationship between Customer and Sales Order entities. Notice that
the minimum number of Sales Order records per Customer record is zero and the maximum is many. This is because
in any given period (a year or month) to which the Sales Order entity pertains, a particular customer may have
purchased nothing (zero Sales Order records) or purchased several times (many records). From the perspective of
the Sales Order entity, however, every record is associated with one and only one customer. The crows foot symbol
(which gives this form of notation its name) depicts the many cardinalities at the Sales Order end of the association
line.
EXAMPLE 4 (1:M). Example 4 represents a situation in which each specific item of inventory is supplied by one
and only one Vendor, and each Vendor supplies one or many different inventory items to the company. Contrast this
(1:M) association with Example 5 next.
EXAMPLE 5 (M:M). To illustrate the many-to-many association, we again use a Vendor and Inventory relationship
in Example 5. This time, however, the company has a policy of purchasing the same types of inventory from
multiple suppliers. Management may choose to do this to ensure that they get the best prices or avoid becoming
dependent on a single supplier. Under such a policy, each Vendor record is associated with one or many Inventory
records, and each Inventory record is associated with one or many Vendors.
Because Apex is a wholesale supply company with no production facilities, model consolidation for them will
include the previously developed revenue cycle model (Figure 10-8) and the expenditure cycle models for
purchases/cash disbursements and payroll illustrated in Figures 10-10 and 10-11, respectively.
A brief explanation of the resources, events, agents, and cardinalities for two expenditure cycle models is provided
next.
The second event entity is Receive Product, which is an economic event that causes a change in an economic
resource. This is the receive half of the exchange and increases inventory. Goods are received from the supplier and
the receiving clerk processes them. This involves counting, inspecting, transporting the products into the warehouse,
transferring title to Apex, and updating the inventory records. The 0 , 1 cardinality in the association between the
Order Product and Receive Product entities implies that at any point in time, an order may exist (occurrence of
Order Product) that has not yet been received (no occurrence of Receive Product).
FIGURE
10-10
Inventory
Order Product
Purchasing Clerk
Supplier
Receive Product
Receiving Clerk
Supplier
Cash
Disburse Cash
Cash
Disbursement
Clerk
FIGURE
10-11
Supervisor
Employee Services
Get Time
Worker
Cash
Disburse Cash
Payroll Clerk
The third event represented in the diagram is Disburse Cash. This is the economic event that constitutes the give
half of an economic exchange. In this case, it causes the Cash resource to be decreased. The 1: M association with
the Supplier entity implies that each disbursement is made to only one supplier, but each supplier may receive zero
or many disbursements during the period. The 1:M association between Disburse Cash and Receive Product implies
that each product receipt is paid in full (no multiple partial payments), but many receipts may be combined and paid
with a single disbursement to reduce check writing.
Notice that M:M associations exist between the Order Product and Inventory entities and between the Receive
Product and Inventory entities. These illustrate that orders placed with suppliers and received from them may
contain one or many items. From the opposite side, these associations signify that each item of inventory may have
been ordered and received zero or many times in the period. As previously discussed, each M:M association needs
to be resolved by adding a linking entity. Tables for the linking entities will ultimately be created in the database, but
the entities will not be included in the REA diagram. Keep in mind also that the internal agents are represented in
the REA diagram as separate entities. This is done to illustrate more clearly their respective roles. In reality, these
agents are instances of the Employee entity and will be collapsed into a single Employee table in the final database.
FIGURE
10-12