The REA Model The REA Model The REA model provides structure for developing an accounting database • It helps to identify • It helps to Types of Entities What is an entity? Three distinct types: 1 RESOURCES 2 EVENTS 3 AGENTS RESOURCES • Resources have economic value to the organization. • What are some examples? AGENTS • Agents are the people and organizations • What are some examples? EVENTS • Events are the business activities • What are some examples? Developing an REA Diagram Four steps: 1. Identify the pair of events 2. Identify the resources affected by each event and the agents 3. Analyze each economic exchange event to determine whether it should be decomposed 4. Determine the cardinalities of each relationship. Basic REA Diagram Resource A Inflow GET Resource A Participant Participant Internal Agent External Agent Economic Duality Resource B Outflow GIVE Resource B Participant External Agent Participant Internal Agent Step 1: Identify Economic Exchange Events • Useful to divide the paper into three columns • Left column should be used for resources. • Middle column should be used for events. • Right column should be used for agents. • The basic economic exchange in the revenue cycle • Draw sales and cash receipts events entities as rectangles • Relationship between them as a diamond. Step 2: Identify Resources and Agents • The sales event involves the disposal of the resource • The cash receipts event involves the acquisition of the resource • Identify the agents who participate in those events. • There will always be at least one internal agent • And in most cases, an external agent Step 3: Include Commitment Events • Can each economic exchange event be decomposed into a combination of one or more commitment exchange events. • • Example: • The sales event may be decomposed into the “take order” • And “deliver order” Decomposing Sales into Orders and Sales Customer Orders InventoryOrders Participant Customer Participant Inventory Leads to Salesperson InventorySales Participant Sales Participant Customer Step 4: Determining Cardinalities • Cardinalities indicate • • Expressed as a pair of numbers. • First number • • Second number • Minimum Cardinality • The minimum cardinality of a relationship • • Minimum cardinalities can be either 0 or 1. A minimum cardinality of zero • A minimum cardinality of 1 • The minimum cardinality of zero in the (0, N) cardinality pair Sales (0, N) Made to Customer • The minimum cardinality of 1 in the (1, 1) cardinality pair Sales (0, N) Made to (1,1) Customer Maximum Cardinality The maximum cardinality of a relationship Maximum cardinalities can be either 1 or N. A minimum cardinality of 1 A maximum cardinality of N • The maximum cardinality of N in the (0, N) cardinality pair Sales (0, N) Made to Customer • The maximum cardinality of 1 in the (1, 1) cardinality pair Sales • (0, N) Made to (1,1) Customer Cardinalities are not arbitrarily chosen by the database designer. Relationships between Entities • 1. 2. 3. Three basic types of relationships A one-to-one relationship (1:1) A one-to-many relationship (1:N) A many-to-many relationship (M:N) A one-to-one relationship Sales 1 1 Cash Receipts A one-to-many relationship Sales N 1 Cash Receipts A one-to-many relationship Example 2 Sales 1 N Cash Receipts A many-to-many relationship M Sales N Cash Receipts ER Diagrams using the REA Model • • An Entity-Relationship (E-R) diagram is a common method for portraying a database schema. An E-R diagram shows • Entities are represented by • Relationships between entities Sample ERD using the REA Model (1,N) (0,N) InventoryPurchases Inventory Purchases (0,N) (1,1) Participant Buyer (Purchasing Agent) (0,N) (1,N) Participant (1,1) Vendor P/D (0,N) Participant (1,1) (0,N) (1,1) Cash (0,N) Stockflow (0,N) Cash Disbursement Participant (1,1) Cashier Implementing the REA Diagram • An REA diagram can be used to design a wellstructured relational database. • Create the schema from the REA diagram. • What is a well designed relational database? Implementing the REA Diagram, continued • Implementing an REA diagram in a relational database is a three-step process: • Create a table • Assign attributes to appropriate tables Use foreign keys to implement • The REA Model (1,N) (0,N) InventoryPurchases Inventory Purchases (0,N) (1,1) Participant Buyer (Purchasing Agent) (0,N) (1,N) Participant (1,1) Vendor P/D (0,N) Participant (1,1) (0,N) (1,1) Cash (0,N) Stockflow (0,N) Cash Disbursement Participant (1,1) Cashier Create the Tables • From the previously discussed REA diagram, nine tables would be created Assign Attributes • Primary keys: • Other Attributes: Implement the 1:1 and 1:M Relationships • FOREIGN KEYS • One-to-One Relationships: • One-to-Many Relationships: • The primary key of the entity with the maximum cardinality of N becomes a foreign key in the entity with a maximum cardinality of 1