Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relation Himpunan entity Relationship Atribut 3 Entity 1 Atribut 1

Similar presentations


Presentation on theme: "Relation Himpunan entity Relationship Atribut 3 Entity 1 Atribut 1"— Presentation transcript:

1 Relation Himpunan entity Relationship Atribut 3 Entity 1 Atribut 1
Hubungan antara dua atau lebih entity

2 Ternary Relationship Student NIM Name Room Subject SubjectId Name
ClassId Class Lecturer NIP Name

3 Ternary Relationship CREATE TABLE Class (NIM CHAR(10),
SubjectId CHAR(6), ClassId CHAR(7), Room CHAR(6), PRIMARY KEY (ClassId), FOREIGN KEY (NIM) REFERENCES Student, FOREIGN KEY (SubjectId), REFERENCES Subject)

4 Role Name NIM Student Coordinate Subordinate CoordinateBy

5 Key Constraint since Faculty FacId Employee NIP Name manages
Hubungan antara dua atau lebih entity CREATE TABLE manages (FacId CHAR(1), NIP CHAR(10), since DATE, PRIMARY KEY (FacId), FOREIGN KEY (FacId) REFERENCES Faculty, FOREIGN KEY (NIP), REFERENCES Employee)

6 Key Constraint since Faculty FacId Employee NIP Name manages
Faculti hanya dimanages oleh maksimal satu employee CREATE TABLE FacMan (FacId CHAR(1), Faculty CHAR(20), NIP CHAR(10), since DATE, PRIMARY KEY (FacId), FOREIGN KEY (NIP), REFERENCES Employee) NIP boleh bernilai null

7 Participation Constraint
since Faculty FacId Employee NIP Name manages Total participation partial participation workIn

8 Participation Constraint
CREATE TABLE FacMan (FacId CHAR(1), Faculty CHAR(20), NIP CHAR(10) NOT NULL, since DATE, PRIMARY KEY (FacId), FOREIGN KEY (NIP), REFERENCES Employee, ON DELETE NO ACTION) NIP tidak boleh bernilai null Record Employee bisa dihapus jika managernya telah diganti

9 Weak Entity* polis cost Name Dependents name age NIP Employee
Garis tebal Weak entity CREATE TABLE depPolis (name CHAR(20), age INTEGER, cost REAL, NIP CHAR(10) NOT NULL, PRIMARY KEY (name,NIP), FOREIGN KEY (NIP), REFERENCES Employee, ON DELETE CASCADE) Dependents adalah Weak entity Dependents dihapus jika Employee dihapus

10 Hirarki Class Name NIP Employee ISA permanent level Room PartTime
hoursWork jobDesc

11 Ternary Relationship Room Subject SubjectId Name Name ClassId NIP
Lecturer Student NIM Name

12 Agregasi Subject subId subject credit semester Class room time day
classId Lecturer nip name Agregate take mark Student nim name ipk

13 Desain Konseptual dengan Model ER
Mengerti institusi yang akan dimodelkan dan informasi yang akan disimpan Pilihan Konsep dimodelkan sebagai entity atau atribut Konsep dimodelkan sebagai entity atau relationship Relationship yang bagaimana? Ternary atau binary? Perlukah agregasi

14 Entity atau Atribut Address Atribut Entity - Satu address per employee
- Cukup sebagai kesatuan string Atribut Address - Lebih dari satu address per employee - Diuraikan menjadi jalan, kota, kode pos Entity Faculty FacId Employee NIP Name workIn2 from to NIM FacId from to 1 1/1/91 2/2/92 2 3/3/93 3/5/94 4 3/1/92 12/12/92 5/7/95 3/5/96

15 Entity atau Atribut Name FacId NIP Faculty workId Faculty workIn3
Employee Duration from to

16 Entity dan Relationship
FacId Faculty dBudget NIP Name since budget manages2 Faculty Employee

17 Entity dan Relationship
FacId Faculty NIP Name budget manages3 Faculty Employee since MgrAppt apptNum dBudget

18 Binary atau Ternary Relationship
Name Dependents name age NIP menanggung Employee polisId cost Polis Polis hanya dimiliki oleh satu orang Tiap polis dimiliki oleh seorang employee Dependent adalah weak entity konjungsi dengan policeID Key constraint Total participation Binary relationship

19 Binary atau Ternary Relationship
Name Dependents name age NIP Employee Purchaser Beneficiary Polis cost polisId

20 Binary atau Ternary Relationship
CREATE TABLE Polis (polisId CHAR(10), cost REAL, NIP CHAR(9) NOT NULL, PRIMARY KEY (polisId), FOREIGN KEY (NIP) REFERENCES Employee, ON DELETE CASCADE) CREATE TABLE Dependents (pname CHAR(20), age INTEGER, polisId CHAR(10), PRIMARY KEY (pname, polisId), FOREIGN KEY (polisId) REFERENCES Polis, ON DELETE CASCADE)

21 Binary atau Ternary Relationship
CREATE TABLE Dependents (pname CHAR(20), NIP CHAR(9), age INTEGER, polisId CHAR(10), PRIMARY KEY (pname, polisId, NIP), FOREIGN KEY (polisId,NIP) REFERENCES Polis, ON DELETE CASCADE)

22 Binary atau Ternary Relationship(Parts)
qty contracts Departments Supliers Parts sid pid S1 P1 S2 P2 pid did P1 D1 D2 P2 sid did S1 D1 S2 D2 sid pid did qty S1 P1 D1 10 S2 D2 20 P2 30 40

23 Agregation atau Ternary Relationship
Subject subId subject credit semester Class room time day classId Lecturer nip name take mark Student nim name ipk

24 Agregation atau Ternary Relationship
Subject subId subject credit semester Lecturer nip name room time take mark day Student nim name ipk

25 Constraint pada Model ER
Kebijakan untuk Kasus Parts Department tidak boleh memesan Part berbeda dari satu Suplier Department harus membuat Contract dengan Suplier tunggal Next on Functional and Inclusion Dependency …


Download ppt "Relation Himpunan entity Relationship Atribut 3 Entity 1 Atribut 1"

Similar presentations


Ads by Google