Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

1 Implementing an REA Model in a Relational Database.

Presentasi serupa


Presentasi berjudul: "1 Implementing an REA Model in a Relational Database."— Transcript presentasi:

1 1 Implementing an REA Model in a Relational Database

2 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 – Memberikan atribut ke tabel yang tepat – Menggunakan kunci luar (foreign key) untuk mengimplementasikan hubungan satu ke satu (one-to-one) dan satu ke banyak (one-to-many)

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

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

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

6 6

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

8 8

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

10 10 EXAMPLE

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

12 12 EXAMPLE

13 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

14 14 EXAMPLE

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

16 16 EXAMPLE

17 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

18 18 Sale Receive Cash Inventory Cash Customer Employee Customer 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). EXAMPLE

19 19 EXAMPLE

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

21 21 EXAMPLE

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

23 23 EXAMPLE

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

25 25 EXAMPLE

26 26 Sale Receive Cash Inventory Cash Customer Employee Customer 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

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

28 28 EXAMPLE

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

30 30 Sale Receive Cash Inventory Cash Customer Employee Customer 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).

31 31 EXAMPLE


Download ppt "1 Implementing an REA Model in a Relational Database."

Presentasi serupa


Iklan oleh Google