E-R Diagram fileRelationship Definition Relationship pada E-R diagram adalah hubungan asosiasi...
Transcript of E-R Diagram fileRelationship Definition Relationship pada E-R diagram adalah hubungan asosiasi...
E-R Diagram
Bagian IIb
Relationship Terminologi
Database Desain
Conceptual
perspective
User’s perspective
Database
Requirements
Logical
Schema
(Relational)
Conceptual
Design
The Entity
Relationalship (ER)
Model is one of the
most widely used
mthod for
conceptual design
Logical
Design
(Mapping)
Conceptual
Schema
(ER)
The Relational Model
is the basic for
several commercial
DBMSs
Internal
Schema
Phases of Database Design
• First step of the design process is to identify the “Universe of Discourse” (UoD)
• The database to be built will not model everything in the world, but rather some “mini-world” or “Universe of Discourse”.
• The UoD is the relevant portion of the real world to be modeled by the database
3
Universe
of Discourse
Phases of Database Design
• Functional Analysis consists of specifying operations (retrievals, updates) that will be applied to the database
• Various techniques for software design exist, such as sequence diagrams, flowcharts, DFDs, etc.
• Refer to Software Engineering Texts
4
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
Phases of Database Design
• Description of the data requirements of users
• Expressed using a high level model such as ENTITY-RELATIONSHIP (ER)
• A database schema in the ER Model can be represented pictorially (ER diagrams)
• ER Model contains detailed descriptions of:
What are the entities and relationships in the enterprise?
What information about these entities and relationships should we store in the database?
What are the integrity constraints or business rules that hold?
5
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
CONCEPTUAL
DESIGN
Phases of Database Design
• Actual implementation of the database, using a commercial DBMS
• Depends on the logical/implementation model of the DBMS, for example Relational Database Model, Object Oriented Database Model.
• Conceptual Model (ER) is mapped to the implementation model (Relational) in this phase
6
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
CONCEPTUAL
DESIGN
LOGICAL
DESIGN
Phases of Database Design
• Database is tuned for storage and performance
• Includes specification of storage structures, access paths, file organization etc.
7
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
CONCEPTUAL
DESIGN
LOGICAL
DESIGN
PHYSICAL
DESIGN
Phases of Database Design
• Data Structures and Operations are closely linked
• Design of the two is done in parallel and subsequent implementation in interdependent
8
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
CONCEPTUAL
DESIGN
LOGICAL
DESIGN
PHYSICAL
DESIGN
Conceptual Design
9
Universe
of Discourse
REQUIREMENTS
COLLECTION
AND ANALYSIS
FUNCTIONAL
ANALYSIS
APPLICATION
PROGRAM
DESIGN
..
.
CONCEPTUAL
DESIGN
LOGICAL
DESIGN
PHYSICAL
DESIGN
CONCEPTUAL
DESIGN
Database
Requirements
Conceptual Schema
(High Level Data Model,
e.g. ER, NIAM, SDM)
Defines the UoD,
and captures
semantics &
constraints of the
UoD
Serves as a
medium for
communicating
the UoD
Focus of
this lecture
Relationship DefinitionRelationship pada E-R diagram adalah hubungan asosiasi antaradua atau lebih entity type
Hubungan ini terjadi karena :
1. Secara konsep E-R diagram memang ditujukan untuk dapatmemperlihatkan hubungan makna antar entity yang dibentuk
2. Secara alamiah wujud-wujud di dunia nyata memilikiketerhubungan satu dengan yang lainnya
Ch :
- Seseorang memiliki kendaraan, maka dapat diidentifikasibahwa ada hubungan kepemilikan yang dapat menunjukkansiapa memiliki kendaraan yang mana
- Sebuah toko menjual beberapa barang dagangan, dapatdinyatakan adanya hubungan yang menjelaskan toko yang mana menjual barang apa saja
10
Membangun Relationship
Gagasan utamanya adalah ingin membangun suatuinformasi yang terkait dengan makna-makna dariketerhubungan antar entity.
Ch :
-Ingin diketahui, pada semester ini siapa sajamahasiswa yang mengambil matakuliah basdat
-Ingin diketahui, siapa saja yang menggunakanruangan kuliah SB-403
11
Relationship Types and Sets
• A Relationship Type defines the relationship, and a Relationship Set represents a set of relationship instances
• A Relationship Type thus defines the structure of the Relationship Set
Relationship Type and corresponding Set are customarily referred to by the same name
12
Formally ...
Relationship Type R didefinisikan sebagai sebuah set asosiasi antara n buah entity types E1, E2, ... En, R adalah subset dari produk Cartesius E1 x E2 x En ...
Setiap Ei dikatakan "berpartisipasi" dalam relationship type
Sebuah Relationship Set R adalah himpunan dari relationship instances ri, dimana setiap ri berasosiasi dengan n individual entities (E1, E2, ... En)
Setiap Ei dikatakan "berpartisipasi" dalam relationship instance
13
Product
Keeps
Store
descrip
qty
price
pname
manager
Locations
sname
Entity Type
Relationship Type
Relationship Type
Product
Keeps
Store
pname
sname
pname
sname
Relationship Set ( n kombinasi )Keeps { sname,pname }
Relationship
Instance( 1 kombinasi )
Relationship Set
• Keeps (table) set of relationship
Contoh
sname pname
Borma Pepsodent
Borma Sabun lux
Borma Susu dencow
Borma Supermie
Griya Sabun cuci
Griya Pepsodent
Alfa mart Susu dencow
… …
instance