E-R Diagram Bagian IIb Relationship Terminologi
Database Desain Conceptual perspective User’s perspective
Database Requirements
The Entity Relationalship (ER) Model is one of the most widely used mthod for conceptual design
Conceptual Design
Conceptual Schema (ER) The Relational Model is the basic for several commercial DBMSs
Logical Design (Mapping)
Logical Schema (Relational)
Internal Schema
Phases of Database Design Universe of Discourse
• 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
Phases of Database Design Universe of Discourse
REQUIREMENTS COLLECTION AND ANALYSIS
FUNCTIONAL ANALYSIS
APPLICATION PROGRAM 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
Phases of Database Design • Universe of Discourse
REQUIREMENTS COLLECTION AND ANALYSIS
FUNCTIONAL ANALYSIS
APPLICATION PROGRAM DESIGN
...
CONCEPTUAL 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
Phases of Database Design Universe of Discourse
REQUIREMENTS COLLECTION AND ANALYSIS
CONCEPTUAL DESIGN
FUNCTIONAL ANALYSIS
LOGICAL DESIGN
APPLICATION PROGRAM 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
Phases of Database Design Universe of Discourse
• Database is tuned for storage and performance • Includes specification of storage structures, access paths, file organization etc.
REQUIREMENTS COLLECTION AND ANALYSIS
CONCEPTUAL DESIGN
FUNCTIONAL ANALYSIS
LOGICAL DESIGN
APPLICATION PROGRAM DESIGN
PHYSICAL DESIGN
... 7
Phases of Database Design Universe of Discourse
REQUIREMENTS COLLECTION AND ANALYSIS
CONCEPTUAL DESIGN
FUNCTIONAL ANALYSIS
LOGICAL DESIGN
APPLICATION PROGRAM DESIGN
PHYSICAL DESIGN
.. .
• Data Structures and Operations are closely linked • Design of the two is done in parallel and subsequent implementation in interdependent
8
Conceptual Design Universe of Discourse Database Requirements
REQUIREMENTS COLLECTION AND ANALYSIS
CONCEPTUAL DESIGN
FUNCTIONAL ANALYSIS
LOGICAL DESIGN
APPLICATION PROGRAM DESIGN
PHYSICAL DESIGN
...
CONCEPTUAL DESIGN
Conceptual Schema (High Level Data Model, e.g. ER, NIAM, SDM)
Defines the UoD, and captures semantics & constraints of the UoD
Focus of this lecture Serves as a medium for communicating the UoD
9
Relationship Definition Relationship pada E-R diagram adalah hubungan asosiasi antara dua atau lebih entity type Hubungan ini terjadi karena : 1. Secara konsep E-R diagram memang ditujukan untuk dapat memperlihatkan hubungan makna antar entity yang dibentuk 2. Secara alamiah wujud-wujud di dunia nyata memiliki keterhubungan satu dengan yang lainnya Ch :
- Seseorang memiliki kendaraan, maka dapat diidentifikasi bahwa ada hubungan kepemilikan yang dapat menunjukkan siapa memiliki kendaraan yang mana - Sebuah toko menjual beberapa barang dagangan, dapat dinyatakan adanya hubungan yang menjelaskan toko yang mana menjual barang apa saja
10
Membangun Relationship Gagasan utamanya adalah ingin membangun suatu informasi yang terkait dengan makna-makna dari keterhubungan antar entity.
Ch : -Ingin diketahui, pada semester ini siapa saja mahasiswa yang mengambil matakuliah basdat -Ingin diketahui, siapa saja yang menggunakan ruangan 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 ...
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 type
Setiap Ei dikatakan "berpartisipasi" dalam relationship instance
13
Relationship Type sname
Entity Type Store
Locations
manager qty
Keeps pname
Relationship Type Product
price descrip
Relationship Set sname Store
sname
Relationship Instance ( 1 kombinasi )
Keeps pname
pname
Product
Keeps { sname,pname }
Relationship Set ( n kombinasi )
Contoh • Keeps (table)
set of relationship
sname
pname
Borma
Pepsodent
Borma
Sabun lux
Borma
Susu dencow
Borma
Supermie
Griya
Sabun cuci
Griya
Pepsodent
Alfa mart
Susu dencow
…
…
instance