1692676481364_PSI-2020---11---Pemodelan-Data---All---student

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

1

MR-4052 PERENCANAAN SISTEM INFORMASI

Pemodelan Data

Minggu 11
2
Tujuan

• Memahami teknik pemodelan data dengan diagram ER


• Mampu mengidentifikasi entitas data dan relasi
• Mampu merancang model ER
3
Entity Relationship (E-R) Model

• Entity–relationship model (ER model) is a high-level


conceptual data model diagram

• ER model describes the structure of a database with the


help of a diagram, which is known as Entity Relationship
Diagram (ER Diagram)
• An ER model is a design or blueprint of a database that can
later be implemented as a database
4
Entity Relationship (E-R) Model
E-R Model Components
• Entities
• In E-R models an entity refers to the entity set.
• An entity is represented by a rectangle containing the entity’s
name.
• Attributes
• Characteristics of entity
• Attributes are represented by ovals and are connected to the
entity with a line.
• Each oval contains the name of the attribute it represents.
• Attributes have a domain -- the attribute’s set of possible values.
• Primary keys are underlined.
• Relationships
5
Classes of Attributes
• A simple attribute cannot be subdivided.
• Examples: Age, Sex, and Marital status

• A composite attribute can be further subdivided to yield additional attributes.


• Examples: ADDRESS  Street, City, State, Zip; PHONE NUMBER  Area code, number

• A single-valued attribute can have only a single value.


• Examples:

• A person can have only one social security number.

• A manufactured part can have only one serial number.

• Multivalued attributes can have many values.


• Examples:

• A person may have several college degrees.

• A household may have several phones with different numbers

• Multivalued attributes are shown by a double line connecting to the entity.


6
Basic E-R Model Entity Presentation
7
The Entity Relationship (E-R) Model
A derived attribute is not physically stored within the
database; instead, it is derived by using an algorithm.
• Example: AGE can be derived from the data of birth and the
current date.
8
The Entity Relationship (E-R) Model
A relationship’s degree indicates the number of associated entities or participants.
• A unary relationship exists when an association is maintained within a single entity.
• A binary relationship exists when two entities are associated.
• A ternary relationship exists when three entities are associated.
9

FUND_ID (fk)
CON_ID (fk) REC_ID (fk)
ID_CFR (pk) CFR_AMOUNT

CON_ID (pk) 1 M M 1 REC_ID (pk)


CONTRIBUTOR CFR RECIPIENT
CON_NAME REC_TYPE
1 M

1 FUND_ID (pk)
M CON_ID (fk)
FUND
FUND_NAME
FUND_AMOUNT
10
The Entity Relationship (E-R) Model
Connectivity
• Describe the relationship classification (e.g., one-to-one, one-to-many, many-to-
many).
Cardinality
• Expresses the specific number of entity occurrences associated with one
occurrence of the related entity.
11
The Entity Relationship (E-R) Model
Recursive Entities
• A recursive entity is one in which a relationship can exist between
occurrences of the same entity set.
• A recursive entity is found within a unary relationship.
12
13
14
The Entity Relationship (E-R) Model
Associative Entities
• The associative entity serves as a bridge between the related
entities.
• The associative entity usually splits up the many-to-many
relationship between the related entities into two one-many
relationships.
• An associative entity is composed of the primary keys of each of
the entities to be connected.
• The associative entity may contain additional attributes that are
peculiar to the relationship.
15
16
Developing an E-R Diagram
• The process of database design is an iterative rather
than a linear or sequential process.
• It usually begins with a general narrative of the
organization’s operations and procedures.
• The basic E-R model is graphically depicted and
presented for review.
• The process is repeated until the end users and
designers agree that the E-R diagram is a fair
representation of the organization’s activities and
functions.
17

MR-4052 PERENCANAAN SISTEM INFORMASI

Pemodelan Data
(EXERCISE)

Minggu 11
18
Exercise 1

A hospital has a large number of registered physicians.


Patients are admitted to the hospital by a physician.
Any patient who is admitted must have exactly one
admitting physician. A physician may optionally admit
any number of patients. Once admitted, a given patient
must be treated by at least one physician. A particular
physician may treat any number of patients or may not
treat any. Whenever a patient is treated by a physician,
the hospital records the details of the treatment.
19
Exercise 2

A company has a number of employees. The


company also has several projects. Each employee
may be assigned to one or more projects or may
not be assigned to a project. A project must have
at least one employee assigned and may have any
number of employees assigned. An employee’s
billing rate may vary by project, and the company
wishes to record the billing rate for each employee
when assigned to a particular project.
20
Rental Kendaraan
Buatlah ERD dari soal berikut.

• Sebuah rental kendaraan (mobil) menyewakan sejumlah kendaraan. Ingin dibangun basis
data untuk mengelola data kendaraan, data supir, data pelanggan serta transaksi
peminjamannya oleh pelanggan.
• Setiap kendaraan memiliki data: No_plat, merek, tahun, no_mesin, tgl_akhir_stnk.
• Pelanggan yang bertransaksi akan dicatat Nama_pelanggan, Alamat, serta No_tlp.
• Pelanggan dapat menyewa sejumlah mobil dalam satu order. Setiap mobil yang dipinjam
selalu berikut supir. Supir tidak selalu membawa mobil yang sama.
• Untuk supir, dicatat informasi mengenai tgl_lahir, nama, alamat, Jenis SIM, tgl_mulai
bekerja.
• Tarif untuk setiap kendaraan telah ada datanya di dalam sistem. Tarif ini sudah termasuk
biaya tenaga supir. Tarif ini fix untuk semua pemakaian, untuk setiap pelanggan, dan tarif
ditetapkan untuk tiap kendaraan karena kondisi tiap kendaraan berbeda.
• Pada suatu transaksi peminjaman oleh pelanggan, potongan harga bisa saja diberikan
dengan mengurangi harga sewa keseluruhan dalam satu order dengan nilai potongan
tertentu, dan besar potongan harga yang diberikan akan dicatat dalam sistem.
21

Terima Kasih

You might also like