Download presentation
Presentation is loading. Please wait.
Published byKerrie Wilkinson Modified over 8 years ago
1
REA analysis and E-R diagramming 4/27/2011
2
What are we hoping to achieve? Tool for designing a database system to meet the needs of the organization REA modeling is a method of analyzing and thinking about the system E-R diagramming is a means of diagramming what the database should look like based upon the analysis above.
3
E-R diagrams Database design involves the determination of what the tables in the database look like (their structure) and how they relate to one another. –Normalization did this A way of representing, or communicating, these structures is with E-R diagrams. –E-R diagrams show what the tables are and how they are related - much like our normalization exercises, but with a slightly different diagrammatic format.
4
Entity-Resource-Agent modeling Entity Relationship -Describes how two entities relate Attribute -Provides specifics for an entity (the column information) -Resource - such as merchandise or cash -Person (what we referred to as entities in DFDs) -Event
5
An example Customers CustomerID CustName CustAddr CustPhone Contact Invoice InvoiceID CustomerID InvoiceDate CustID 1 M Invoice-Item InvoiceID ItemID QuantOrd InvoiceID Inventory ItemID Description Bin_No Cost QOH ROP 1 1 M N
6
Entity-Relationship diagrams
7
Entity-Relationship modeling Cardinality –Within the context of ER modeling, we can characterize the cardinality of a relationship. –Cardinality has to do with the number of possible outcomes that we are combining together Designations –1-1 (one to one) This is when two tables are related and for every occurrence of the primary key in the first table, there is one and only one occurrence of the foreign key in the second table. Third normal form does not require any 1 - 1 relations
8
Entity-Relationship modeling Designations –1-M (one to many) This is the most common relationship The primary key of the first table is unique in the second table Consider a customer table and an invoice table –Each customer may have MANY invoices –Each invoice relates to ONLY ONE customer tblCustomer CustNo. tblInvoice InvoiceNo. CustNo. 1M
9
Entity-Relationship modeling Designations –M-M (many to many) This is frequent in accounting contexts. You have two tables –In each table, there are multiple occurrences of the primary key of the other table Example is Invoices and Inventory Items –Each invoice may have several items in inventory –Each item in inventory may appear on several invoices The solution is to create a table that has a COMPOSITE PRIMARY KEY and build TWO relations tblInventory ItemNo tblInvoice InvoiceNo ItemNo.InvoiceNo. tblInvoiceLine ItemNo InvoiceNo 11MM
11
Entity-Relationship diagrams Tbl_Customers Cust_Code Cust_Code Tbl_SO SO_NUM Tbl_SO_ITEM Item_Number SO_NUM Tbl_Inventory Item_Number InvoiceID Item_Number Tbl_SO_ITEM Item_Number SO_NUM M M M 1 1 1
13
Entity-Relationship diagrams tblEMPLOYEE EMPNUM EMPNUM tblIDTAG TAGNUM PACKID tblTAGNO TAGNUM TAGNUM (1,M) tblTAGNO TAGNUM M M 1 1
14
Entity-Relationship diagrams
15
What are we hoping to achieve with REA modeling? What we want to do is follow a structured approach for designing databases. The basic element in a database is called an entity - a table
16
Resource-Event-Agent modeling REA modeling is a hot topic in systems circles Some books combine REA and E-R diagramming and some make no distinction
17
Resource-Event-Agent analysis and modeling We focus on events, which are things that get recorded in our system For each event we will possibly have –The event itself –Resources consumed or obtained –Internal agents (entities) –External agents (entities) The reason that the word entities is in parentheses is that with this type of modeling, all five of these things are referred to as “entities”
18
Who What
19
Entity-Relationship diagramming Recall that it uses three symbols –A rectangle An entity (but not the same as in DFDs and flowcharts –A diamond A relationship –An oval An attribute A specific form of E-R model is called REA (Resource-Event-Agent) modeling REA is specifically for Accounting Information Systems
20
Basic Template Resource A Get Resource A Internal Agent External Agent Inflow Participant Resource B Give Resource B Internal Agent External Agent Outflow Participant Economic Duality
21
Basic Template This is a slightly more restrictive view than we previously took. –Exchange event is two sided (balance sheet equation) –Commitment events (inquiry events?) LEAD TO exchange events (don’t worry about these) –Every exchange must have an internal and external agent
22
Four steps to developing an REA Diagram Identify the pair of economic exchange events Identify resources (balance sheet accounts) and agents –There will always be at least one internal and one external agent for economic exchange events. Examine whether it should be broken down to include “commitment-type” events Determine cardinalities of relationships
23
Identify the pair of economic exchange events Give Inventory Get Cash Example - Revenue Cycle:
24
Identify resources and agents Resources for the sales (revenue) cycle: –Inventory –Cash Agents for the sales cycle: –Internal - Salesperson/Cashier –External - Customer
25
USING the REA diagram Create a table for each entity and one for each M:N relationship –You need a table for each M:N relationship to concatenate the primary keys for the two tables Put the appropriate attributes (columns) in the tables Implement relationships
26
Example WE-FIX-COMPUTERS operates a repair shop for PCs. This describes their purchase system for parts. They order parts from more than a dozen vendors. Sometimes vendors ship partial orders. We-Fix pays for purchases by the 10 th of the next month. It always pays each invoice in full (no installment payments). There is a single purchase manager through which all purchases are made. Let’s consider the Order event and the Purchase event. We will have “place holders” for the Cash Disbursement event, but will not worry about it.
27
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee Vendor
28
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee Vendor
29
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO Vendor 1 M 1 M Here, there is only one employee… the purchase manager… that is called by the purchase order.
30
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO PO- ItemID Vendor 1 M 1 M M M Here, we have a Many to Many relationship because each item in inventory can appear on several purchase orders and each purchase order has possibly several inventory items. See next slide for solution.
31
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO Vendor 1 M 1 M ItemID PO- Line Item PO 1 1 M M We create a NEW table with a composite primary key to resolve the M-M dilemma.
32
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO Vendor 1 M 1 M ItemID PO- Line Item PO 1 1 M M We have a 1-M relation between orders and receipts ONLY because vendors might make partial shipments (so more than one shipment is received for a given PO) 1 M
33
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO Vendor 1 M 1 M ItemID PO- Line Item PO 1 1 M M Again, we have a Many to Many relationship that we must resolve. 1 M M M
34
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO Vendor 1 M 1 M ItemID PO- Line Item PO 1 1 M M 1 M Rec. Rept. - Line Item RR ItemID 1 1 M M Again, we create a NEW table with a composite primary key to resolve the M-M dilemma.
35
Order Invty Receive Invty Cash Disb Inventory Cash Vendor Employee PO RR PO Vendor RR Vendor 1 M 1 M ItemID PO- Line Item PO 1 1 M M 1 M Rec. Rept. - Line Item RR ItemID 1 1 M M 1 1 M M The internal and external agents are handeled in the same way as the order process, but there is a different employee.
36
Entity-Relationship modeling
37
tblCashDisbursement Check No. tblPurchaseOrder PO No. tblCashDisbursement InventoryReceipt Inv Rec No. + Chk No tblInventoryReceipt Inv Rec No tblMaterialsInventory Inv. Stck No tblVendor Vendor No. tblPO InventoryReceipt PO No. + Inv Stck No. Check No. Inv Receipt No. Vendor No. PO No. Inv Stock No. Date Inventory data Vendor data
38
Entity-Relationship modeling tblCashDisbursement Check No. tblPurchaseOrder PO No. tblCashDisbursement InventoryReceipt Inv Rec No. + Chk No tblInventoryReceipt Inv Rec No tblMaterialsInventory Inv. Stck No tblVendor Vendor No. tblPO InventoryReceipt PO No. + Inv Stck No. Check No. Inv Receipt No. Vendor No. PO No. Inv Stock No. Date Inventory data Vendor data
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.