sistem basis data - fathur's...

21
4/20/2007 Fathur'2011 Berisikan pemodelan data yang tertuang dalam analisa data beserta relasi yang ada dalam bentuk ERD yang diusulkan Peter P.Chen, CDM hanya memperlihatkan item-item sebagai berikut : - Entiti - Relasi - Kardinalitas Rancangan Basis Data 1. Context Data Model (CDM) N M Mahaiswa Isi KRS N M Pilih Matakuliah

Upload: vuminh

Post on 02-Feb-2018

291 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Berisikan pemodelan data yang tertuang dalam analisa data beserta relasi yang ada dalam bentuk ERD yang diusulkan Peter P.Chen, CDM hanya memperlihatkan item-item sebagai berikut :

- Entiti

- Relasi

- Kardinalitas

Rancangan Basis Data

1. Context Data Model (CDM)

NMMahaiswa Isi KRSNM

Pilih Matakuliah

Page 2: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Pemodelan Data :Entity Relationship Diagram (ERD)/Diagram Hubungan Entitas (DHE)

Fungsi : - memodelkan data

- melihat data yang akan disimpan

Simbol-simbol :

: - Entity Set/objek data

- Kata benda

Contoh : mahasiswa, pelanggan, barang, dan lain-lain

: - Relationship/hubungan

- Menghubungan entity set

- Kata kerja

contoh : kerja, ambil, isi, dan lain-lain

Atribut : Ciri dari sebuah entity

Cardinality : - tingkat hubungan

- melihat tingkat hubungan suatu relationship

1 : M (hubungan satu ke banyak)

M : N (hubungan banyak ke banyak)

1 : 1 (hubungan satu ke satu)

Tidak boleh ada hubungan antar relationship

Page 3: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

The Entity Relationship (ER)

Model• ER Modeling is a top-down approach to database

design.

• Entity Relationship (ER) Diagram

– A detailed, logical representation of the entities,

associations and data elements for an

organization or business

• ERD represents the conceptual database as viewed

by end user

• ERDs depict the ER model’s three main components:

– Entities

– Attributes

– Relationships

Page 4: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Entity-Relationship (ER) Modeling.

• ER Modeling is a top-down approach to

database design.

• Entity Relationship (ER) Diagram

– A detailed, logical representation of the entities,

associations and data elements for an organization or

business

• Notation uses three main constructs

– Data entities

– Relationships

– Attributes

Chen Model &

Crow’s Foot

Model

Page 5: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Person, place, object, event

or concept about which data

is to be maintained

named property or

characteristic of an

entity

Association

between the

instances of one or

more entity types

Represents a set or collection of

objects in the real world that

share the same properties

Chen Notation

EntityName Verb Phrase AttributeName

Page 6: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Entities

• Refers to the entity set and not to a

single entity occurrence

• Corresponds to a table and not to a row

in the relational environment

• In both the Chen and Crow’s Foot

models, an entity is represented by a

rectangle containing the entity’s name

• Entity name, a noun, is usually written in

capital letters

Page 7: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Entity vs. Entity Set (Entities)

Entity Set (Entities) --- Student

John Smith (999-21-3415, jsmith@, John Smith, 18, 3.5)

Students in ITCS3160

999-21-3415, jsmith@, John Smith, 18, 3.5999-31-2356, jzhang@, Jie Zhang, 20, 3.0999-32-1234, ajain@, Anil Jain, 21, 3.8

entity

Page 8: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Is it an entity?

Rules:

1. An entity must be important to the organisation.

2. An entity must have at least one attribute.

3. An entity must occur more than once (there must be more than one customer)

4. Each entity occurrence (record) must be uniquely identifiable (customer id)

Page 9: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Entities

• Examples of entities:– Person: EMPLOYEE, STUDENT, PATIENT

– Place: STORE, WAREHOUSE

– Object: MACHINE, PRODUCT, CAR

– Event: SALE,REGISTRATION, RENEWAL

– Concept: ACCOUNT, COURSE

• Guidelines for naming and defining entity types:– An entity type name is a singular noun

– An entity type should be descriptive and specific

– An entity name should be concise

– Event entity types should be named for the result of the event, not

the activity or process of the event.

Page 10: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

Attributes

• Characteristics of entities

• In Chen model, attributes are

represented by ovals and are connected

to the entity rectangle with a line

• Each oval contains the name of the

attribute it represents

• In the Crow’s Foot model, the attributes

are simply written in the attribute box

below the entity rectangle

Page 11: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Jenis Attribute

• Composite vs Simple(atomic) Attributes

• Single-valued vs Multivalued Attributes

• Stored vs Derived Attributes

• Null values

• Complex Attributes

• Key Attribute

Page 12: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Composite vs Simple (Atomic)

• Composite attributes dapat dibagi ke subbagian yang lebih

kecil dan merepresentasikan attribute yang lebih dasar

• Simple attributes tidak dapat dibagi

• Contoh: Alamat -> Jalan, Kota, Propinsi,KodePos, Negara;

Jalan -> NoRumah, NamaJalan

Single-valued vs Multivalued Attributes

• umur -> single-valued

• noTelpon -> multivalued

Store vs Derived Attributes

• umur -> derived attribute dari tglLahir

• tglLahir -> stored attribute

Null values

• noTelpon -> null (jika tidak punya telpon)

Page 13: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Relationship

• Manager yang mengelola suatu Department ->

hubungan antara Employee dengan Department; manages

• Department yang mengontrol suatu Project ->

hubungan antara entity Department dengan Project; controls

• Employee yang bekerja pada Department tertentu ->

hubungan antara entity Employee dengan Department;

works_for

• Cardinality Ratios untuk relationship biner menggambarkan

jumlah instances suatu entity dapat berpartisipasi

Contoh: works_for;

DEPARTMENT:EMPLOYEE = 1:N

Kemungkinan cardinality ratios: 1:1, 1:N, N:1, M:N

Page 14: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Id_B(pk)

-dt_B

-id_A(FK

)

Id_A(pk)

- dt_A

11AC

B

Id_A(fk)

Id_B(fk)

Id_B(pk)

dt_B

-Id_B(fk)

Id_A(pk)

- dt_A

M1AC

B

Id_A(fk)

Id_B(fk)

Id_B(pk)

- dt_B

Id_A(pk)

- dt_A

NMAC

B

Id_A(fk)

Id_B(fk)

- Dt_C

Page 15: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

KdKul (PK)

NamaKul

sks

NIM (FK)

KdKul (FK)

Nilai

NIM (PK)

Nama

Alamat

NMMahaiswaambil

Mata kuliah

contoh :

1. Dalam sistem perkuliahan, seorang mahasiswa dapat mengambil lebih

dari satu mata kuliah, dan 1 mata kuliah dapat diambil oleh lebih 1

mahasiswa.

ERD-nya adalah :

2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat

memegang lebih dari satu jabatan dan satu jabatan hanya dapat

dipegang oleh satu pegawai, maka ERD-nya adalah ?

Page 16: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

1. Weak Entity (Entitas lemah)

Terjadi bila sebuah entity tidak memiliki primary key bergantung pada strong key

Contoh :

Jenis-Jenis Entitas :

- tanggal

- jum_masuk

- jum_keluar

* NIP

- Nama

- Alamat

M1PegawaiIsi

Absensi

- tglBayar

- Jum_Angsur* NoPinj

* NoPinj

- tgl

- jum

- ferk

NMPinjamanangsu

r

Angsuran

Page 17: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

2. Agregation (Agregasi)

Terjadi bila dua buah entiti yang berlesai akan direlasikan ke entiti lain.

Contoh ;

Jenis-Jenis Entitas :

* Noang

* NoBuku

* Kd_Denda

- Jumlah

* Kd_Denda

- Jenis

M

* NoBuku

- Judul* Noang

* NoBuku

* Noang

- Nama

- Alamat

NMAnggotapinja

m

Buku

Kembal

i

Denda

N

Page 18: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

3. Spesialisasi dan Generalisasi (Is A)

Terjadi bila terdapat beberpa atribut pada beberapa entiti dengan Primary Key (PK)

yang sama.

Contoh :

Jenis-Jenis Entitas :

- Nama

- Edisi

- Harga

- Judul

- NRP

- Judul

- Pengarang

- Harga

*

No_Koleksi

- Tgl_Beli

Koleksi

Is A

Buku Skripsi Majalah

- Upah_Hari

- UpahLembur

- GajiPokok

- t_anak

- t_sehat

* NIP

- NamaPegawai

Is A

Tetap Honorer

Page 19: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

KRS

NoKrs (PK1) (FK)

NIM (PK2) (FK)

ThAkad

Semester

StatusStudi

Berisikan ERD yang didasarkan pada CDM yang ada. LDM menggunakan notasi ERD yang diusulkan oleh James Martin atau dikenal dengan notasi Informastion Engineering. Bentuk LDM ini sudah menyertakan item-item berikut :

- Entiti

- Kardinalitas

- Atribut-atribut key dan non key

- Transformasi kardinalitas Many-to-Many dalam CDM ke dalam bentuk

Associative Entity

2. Logical Data Model (LDM)

MHS

NIM (PK)

Nama

Alamat

TmpLahir

TglLahir

KdJurusan

ThnMasuk

Status

PilihMK

NoKRS (PK1)(FK)

KodeMK (PK2)(FK)

StatusUlang

HMutu

Page 20: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Notasi LDM

• Chen Model

– 1 to represent one.

– M to represent many

• Crow’s Foot

many

One

One or many

1

M

Zero or many

One or one

Zero

Page 21: SISTEM BASIS DATA - Fathur's blogfathurrohman.staff.ipb.ac.id/files/2011/04/Basisdata-7-8.pdf · 2. Dalam sistem kepegawaian, jika asumsi seorang pegawai dapat ... basis, data, informasi,

4/20/2007 Fathur'2011

Lecturer Classhandles

A Lecturer may handle zero or many classes.

A class is handled by one and only one Lecturer.

(0,N)(1,1)

Lecturer Class

(0,N) (1,1)

handles1

M