1 / 31

Implementing an REA Model in a Relational Database

Implementing an REA Model in a Relational Database. IMPLEMENTING AN REA DIAGRAM IN A RELATIONAL DATABASE. Ada tiga tahap dalam mengimplementasikan diagram REA ke dalam database relasional : Membuat sebuah tabel untuk : Setiap entitas yang berbeda Setiap hubungan banyak ke banyak

lenka
Download Presentation

Implementing an REA Model in a Relational Database

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementing an REA Model in a Relational Database

  2. IMPLEMENTING AN REA DIAGRAM IN A RELATIONAL DATABASE • Adatigatahapdalammengimplementasikan diagram REA kedalam database relasional: • Membuatsebuahtabeluntuk: • Setiapentitas yang berbeda • Setiaphubunganbanyakkebanyak • Memberikanatributketabel yang tepat • Menggunakankunciluar (foreign key) untukmengimplementasikanhubungansatukesatu (one-to-one) dansatukebanyak (one-to-many)

  3. EXAMPLE Below is a sample REA diagram for a very simple revenue cycle. Customer Inventory Sale Employee Customer Cash Receive Cash 3

  4. EXAMPLE Our first step is to create a table for each event, resource, agent, and many-to-many relationship. Customer Inventory Sale Employee Customer Cash Receive Cash 4

  5. EXAMPLE There are two events. Customer Inventory Sale Employee Customer Cash Receive Cash 5

  6. EXAMPLE 6

  7. EXAMPLE There are two resources. Customer Inventory Sale Employee Customer Cash Receive Cash 7

  8. EXAMPLE 8

  9. EXAMPLE There are two types of agents: customers and employees. Customer Inventory Sale Employee Customer Cash Receive Cash 9

  10. EXAMPLE 10

  11. EXAMPLE There is one many-to-many relationship. Customer Inventory Sale Employee Customer Cash Receive Cash 11

  12. EXAMPLE 12

  13. Langkah berikutnya adalah memberikan atribut ke tabel yang tepat Atribut pertama merupakan kunci utama (primary key), yang terdiri dari sebuah atribut atau kombinasi dari beberapa atribut yang secara unik mengidentifikasi setiap baris dalam tabel tersebut. EXAMPLE 13

  14. EXAMPLE 14

  15. Atribut lainnya yang perlu diidentifikasi merupakan fakta-fakta yang ingin dikumpulkan yang menggambarkan masing-masing entitas. EXAMPLE 15

  16. EXAMPLE 16

  17. Langkah terakhir adalah menggunakan kunci luar untuk mengimplementasikan hubungan 1 : 1 dan 1 : N Hubungan satu ke banyak, diimplementasikan dengan cara memasukkan kunci utama tabel yang berderajat 1 ke tabel yang berderajat N Hubungan 1 : 1, diimplementasikan dengan cara: Masukkan kunci utama dari entitas yang berderajat minimum 1 ke dalam entitas yang berderajat minimum 0 Masukkan kunci utama dari entitas (kegiatan) yang terjadi pertama kali ke dalam entitas yang terjadi kemudian. EXAMPLE 17

  18. EXAMPLE The relationship between customer and sales is a 1:N relationship. We make the primary key for the entity that occurs only once (customer) serve as a foreign key in the entity that can occur many times (sale). Customer Inventory Sale Employee Customer Cash Receive Cash 18

  19. EXAMPLE 19

  20. EXAMPLE Likewise, the primary key for employee should be a foreign key in the sales table. Customer Inventory Sale Employee Customer Cash Receive Cash 20

  21. EXAMPLE 21

  22. EXAMPLE The primary key for employee should also be a foreign key in the receive cash table. Customer Inventory Sale Employee Customer Cash Receive Cash 22

  23. EXAMPLE 23

  24. EXAMPLE The primary key for customer should also be a foreign key in the receive cash table. Customer Inventory Sale Employee Customer Cash Receive Cash 24

  25. EXAMPLE 25

  26. EXAMPLE • The relationship between sales and receive cash is 1:1. Two guidelines will produce the same result. • Put the primary key of the event with the minimum of one (sales) as a foreign key in the event with the minimum of zero (receive cash); or Customer Inventory Sale Employee Customer Cash Receive Cash 26

  27. EXAMPLE • Put the primary key of the event that occurs first (sales) as a foreign key in the event that occurs second (receive cash). Customer Inventory Sale Employee Customer Cash Receive Cash 27

  28. EXAMPLE 28

  29. EXAMPLE The relationship between sales and inventory is a many-to-many relationship and was already implemented by the creation of a separate table. Customer Inventory Sale Employee Customer Cash Receive Cash 29

  30. EXAMPLE In the relationship between cash and receive cash, the primary key for the event that occurs once (cash) should be a foreign key in the event that occurs many times (receive cash). Customer Inventory Sale Employee Customer Cash Receive Cash 30

  31. EXAMPLE 31

More Related