Relation Himpunan entity Relationship Atribut 3 Entity 1 Atribut 1

Slides:



Advertisements
Similar presentations
ER to Relational Mapping. Logical DB Design: ER to Relational Entity sets to tables. CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER,
Advertisements

Logical DB Design: ER to Relational Entity sets to tables. Employees ssn name lot CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER, PRIMARY.
Conceptual Design using the Entity-Relationship Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
1 Pertemuan > Relational Model SQL DDL, SQL DML, Aljabar dan Kalkulus Matakuliah: >/ > Tahun: > Versi: >
1 Pertemuan Perluasan E-R Matakuliah: >/ > Tahun: > Versi: >
SQL Data Manipulation Language (DML)
The Entity-Relationship Model
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Book Chapter 3 (part 2 ) From ER to Relational Model.
1 541: Database Systems S. Muthu Muthukrishnan. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.)  What are the entities.
1 Key Constraints Consider Works_In: An employee can work in many departments; a dept can have many employees. In contrast, each dept has at most one manager,
The Entity-Relationship Model
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Comp3300/fall021 The Entity-Relationship Model Chapter 2 What are the steps in designing a database ? Why is the ER model used to create an initial design?
Conceptual Design and The Entity-Relationship Model
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 176 Database Systems I The Entity-Relationship Model.
1 The Entity-Relationship Model Chapter 2. 2 Overview of Database Design  Conceptual design: (ER Model is used at this stage.) –What are the entities.
1 Translation of ER-diagram into Relational Schema Prof. Sin-Min Lee Department of Computer Science.
SPRING 2004CENG 3521 The Relational Model Chapter 3.
The Entity-Relationship Model
Conceptual Design Using the Entity-Relationship (ER) Model
The Entity- Relationship Model CS 186 Fall 2002: Lecture 2 R &G - Chapter 2 A relationship, I think, is like a shark, you know? It has to constantly move.
The Entity-Relationship (ER) Model CS541 Computer Science Department Rutgers University.
Conceptual Design and The Entity- Relationship Model CS 186 Spring 2006 Lectures 19 & 20 R &G - Chapter 2 A relationship, I think, is like a shark, you.
The Entity- Relationship Model R &G - Chapter 2 A relationship, I think, is like a shark, you know? It has to constantly move forward or it dies. And I.
ER continued, and ER to Relational Mappings R&G Chapters 2, 3 Lecture 22.
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
ER to Relational Mapping. Logical DB Design: ER to Relational Entity sets to tables. CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER,
Chapter 2.  Conceptual design: (ER Model is used at this stage.) ◦ What are the entities and relationships in the enterprise? ◦ What information about.
Christoph F. Eick: Designing E/R Diagrams 1 The Entity-Relationship Model Chapter 3+4.
The Relational Model1 ER-to-Relational Mapping and Views.
ICS 321 Fall 2009 The Relational Model (ii) Asst. Prof. Lipyeow Lim Information and Computer Science Department University of Hawaii at Manoa 9/10/20091Lipyeow.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Database Management Systems,1 Conceptual Design Using the Entity-Relationship (ER) Model.
1 Conceptual Design using the Entity- Relationship Model.
Lecture 3 Book Chapter 3 (part 2 ) From ER to Relational.
ER & Relational: Digging Deeper R &G - Chapters 2 & 3.
Mapping E/R to RM, R. Ramakrishnan and J. Gehrke with Dr. Eick’s additions 1 Mapping E/R Diagrams to Relational Database Schemas Second Half of Chapter.
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
1 CS122A: Introduction to Data Management Lecture #5 (E-R  Relational, Cont.) Instructor: Chen Li.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Introduction to Database Design
Conceptual Design and The Entity-Relationship Model
The Entity-Relationship Model
CAS CS 460/660 Data Base Design Entity/Relationship Model
Logical DB Design: ER to Relational
The Entity-Relationship Model
Design Concepts & ER Model
ER-to-Relational Mapping
The Entity-Relationship Model
The Entity-Relationship Model
The Relational Model Lecture 3 INFS614, Fall
Translation of ER-diagram into Relational Schema
Mapping ER Diagrams to Tables
From ER to Relational Model
The Entity-Relationship (ER) Model
The Entity-Relationship Model
Translation of ER-diagram into Relational Schema
The Entity-Relationship Model
More on ER Model and the Relationship Model
CS4433 Database Systems Relational Model.
Question Which of the following plays an important role in representing information about the real world in a database? Explain briefly 1)DDL.
The Entity-Relationship Model
The Entity-Relationship Model
CS4222 Principles of Database System
The Entity-Relationship (ER) Model
Presentation transcript:

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

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

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)

Role Name NIM Student Coordinate Subordinate CoordinateBy

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)

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

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

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

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

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

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

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

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

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 132226958 1 1/1/91 2/2/92 2 3/3/93 3/5/94 132224246 4 3/1/92 12/12/92 5/7/95 3/5/96

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

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

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

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

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

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)

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)

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

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

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

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 …