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 Logical Design (Mapping) Conceptual Schema (ER) The Relational Model is the basic for several commercial DBMSs 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. 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... CONCEPTUAL 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 FUNCTIONAL ANALYSIS APPLICATION PROGRAM. CONCEPTUAL LOGICAL 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 Database is tuned for storage and performance Includes specification of storage structures, access paths, file organization etc. Universe of Discourse REQUIREMENTS COLLECTION AND ANALYSIS FUNCTIONAL ANALYSIS APPLICATION PROGRAM... CONCEPTUAL LOGICAL PHYSICAL 7
Phases of Database Design Universe of Discourse REQUIREMENTS COLLECTION AND ANALYSIS FUNCTIONAL ANALYSIS APPLICATION PROGRAM. CONCEPTUAL LOGICAL PHYSICAL 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 REQUIREMENTS COLLECTION AND ANALYSIS CONCEPTUAL Database Requirements Defines the UoD, and captures semantics & constraints of the UoD FUNCTIONAL ANALYSIS LOGICAL CONCEPTUAL Focus of this lecture APPLICATION PROGRAM. PHYSICAL Conceptual Schema (High Level Data Model, e.g. ER, NIAM, SDM) Serves as a medium for communicating the UoD 9
Relationship Definition Relationship pada E-R diagram adalah hubungan asosiasi antara duaatau 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... 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
Relationship Type Entity Type Store sname Locations manager qty Keeps Relationship Type Product pname price descrip
Relationship Set sname Store Relationship Instance ( 1 kombinasi ) sname pname Keeps pname Product Keeps { sname,pname } Relationship Set ( n kombinasi )
Contoh Keeps (table) sname Borma Borma Borma Borma Griya Griya Alfa mart set of relationship pname Pepsodent Sabun lux Susu dencow Supermie Sabun cuci Pepsodent Susu dencow instance