Database Management system

Slides:



Advertisements
Similar presentations
THE EXTENDED ENTITY RELATIONSHIP MODEL (EERM)
Advertisements

Developing ER-Diagram
Advanced Data Modeling
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 5 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 6 Advanced Data Modelling
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Chapter 4 Entity Relationship (E-R) Modeling
Chapter Five Data Modeling with the Entity-Relationship Model.
Entity Relationship Model Chapter 6. Basic Elements of E-R Model Entity Object of the real world that stores data. Eg. Customer, State, Project, Supplier,
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 2 This material was developed by Oregon Health & Science.
Chapter 8 Data Modeling Advanced Concepts Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Slide content original, slide layout from Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
IS 475/675 - Introduction to Database Design
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
Database Design 3: Advanced Data Modeling Concepts CS 320.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Entity Relationship Modeling
Database Systems: Design, Implementation, and Management Ninth Edition
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Data Modeling Advanced Concepts Updated 20/4/2015 TMC2034 Database Concept and Design1.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
1 Database Design Entity-Relationship Modeling N. Ilayaraja PSG Tech.
Entity-Relationship Data Model
Entity Relationship (E-R) Model
COP Introduction to Database Structures
Contents Design Process Modeling Constraints E-R Diagram Design Issues
Comp 1100 Entity-Relationship (ER) Model
Database Design Chapters 17 and 18.
Data Modeling Using the ERD
Let try to identify the conectivity of these entity relationship
Business System Development
Chapter 5 Database Design
Entity Relationship Model
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Entity Relationship (E-R) Modeling
Entity-Relationship Model
Tables and Their Characteristics
Chapter -3- Data Modeling Using the Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Chapter 7: Entity-Relationship Model
Chapter 7 Entity-Relationship Model
ER example : movie & category
Database EER.
Outline of the ER Model By S.Saha
COS 346 Day 8.
CS 174: Server-Side Web Programming February 12 Class Meeting
Module 8 – Database Design Using the E-R Model
Data Modeling with Entity Relationship Diagrams (Cont.)
MIS2502: Data Analytics Relational Data Modeling
Database Modeling using Entity Relationship Model (E-R Model)
Chapter 5 Advanced Data Modeling
Chapter 7: Entity-Relationship Model
Entity-Relationship Diagram (ERD)
Database EER.
Entity Relation Model Tingting Zhang.
Database Management system
Entity-Relationship Data Model
Entity Relationship (ER) Modeling
Presentation transcript:

Database Management system CS 222 Lecture 4 Database Management system Somchai Thangsathityangkul

University Teaching Database Design an E-R schema for a database to store info about professors, courses and course sections indicating the following: The name and employee ID number of each professor The salary and email address(es) for each professor How long each professor has been at the university

University Teaching Database The course sections each professor teaches The name, number and topic for each course offered The section and room number for each course section Each course section must have only one professor Each course can have multiple sections

University Teaching Database Design an E-R schema for a database to store info about professors, courses and course sections indicating the following: The name and employee ID number of each professor The salary and email address(es) for each professor How long each professor has been at the university The course sections each professor teaches

University Teaching Database Design an E-R schema for a database to store info about professors, courses and course sections indicating the following: The name, number and topic for each course offered The section and room number for each course section Each course section must have only one professor Each professor can teach more than one course and section Each course can have multiple sections

Entity Course & Section Number: 3753 Name: Database Management Systems Topic: Introduction to DBMSs

Section is a Weak Entity

Entity Professor

E-R Diagram

Relationships between Professor and Section

Relationships between Professor and Section

Final E-R Diagram in Crowfoot ’s Model

An ORDER ENTRY FORM

Step 1: Model the Entities In the case of the Order Entry example, there are several candidate entities. The initial analysis of the Order Entry Form indicates that there are three entities that are clearly represented on the form: ORDER, CUSTOMER, and PRODUCT.

An ORDER ENTRY FORM ORDER CUSTOMER PRODUCT

Step 1: Model the Entities (Cont) After identifying the entities, we need to decide which attributes to place with each entity. We must make an assumption on some attribute such as price. If the price of a product does not change from one order to another, then PRICE is a function of PRODUCT. If, however, different orders for the same product have different prices, then PRICE is a function of the relationship between PRODUCT and ORDER.

Step 1: Model the Entities (Cont) Entity Attributes ORDER ORDER-NO, DATE PRODUCT PROD-ID, DESCRIPTION, PRICE CUSTOMER CUSTOMER-ID, CUST-NAME

Step 2: Choose Primary Keys After identifying and modeling each entity and its attributes, primary keys must be chosen for each entity. For each instance of the entity the value of the attribute must be unique and never be null. Primary key will never changes.

Step 2: Choose Primary Keys (Cont) Suppose that a database designer decided to make the primary key of the entity CUSTOMER the customer's phone number. Assume for the moment that each customer has a phone number and that no two customers can have the same phone number. This means unique. Problem may occur. What happens if a customer changes his or her phone number? If the primary key value is changed for a record in the CUSTOMER table, related records in other tables must also be changed.

Step 2: Choose Primary Keys (Cont) When no suitable primary key can be found among the existing attributes for an entity, it is acceptable, and in fact usually a good idea, to simply create a new attribute. So, we create a CUSTOMER-ID that generating a unique number as a primary key for customer. So as product, we create a PROD-ID that generating a unique number as a primary key for product. ORDER-NO is always unique and never change for the order form. We can use ORDER-NO as a primary key for order.

Step 2: Choose Primary Keys (Cont) Now, we draw the initial entities

Step 3: Model Relationships In the case of the Order Entry Form example, ORDER and CUSTOMER are related because CUSTOMER places an ORDER. As are ORDER and PRODUCT because an ORDER contains PRODUCT. However, we know that there may not necessarily be a relationship between PRODUCT and CUSTOMER. Because both are related to ORDER we can report which products are ordered by a particular customer.

Step 3: Model Relationships (Cont) We may draw the pair of relationships in matrix table. CUSTOMER ORDER PRODUCT - PLACE CONTAIN

Step 3: Model Relationships (Cont) Now , we must identify connectivity of each relationship. 1 M N 1 1 M 1

Step 3: Model Relationships (Cont) We may need to identify cardinality of each relationship. An ORDER must be related to only one CUSTOMER but CUSTOMER may have many orders or may not have any order. ( 1,1 ) ( 0,N ) ( 1,1 ) ( 0,N )

Step 3: Model Relationships (Cont) It is reasonable to assume that we have products that have not been ordered yet. If this is allowed, then the minimum cardinality from PRODUCT to ORDER is zero. PRODUCT may be in many orders but ORDER must contain at least one product. ( 1,N ) ( 0,N ) ( 1,N ) ( 0,N )

The whole ER model

Step 4 - Check the Model The final step in creating an E-R diagram is often overlooked, but is just as important as any of the previous steps. Analysts who fail to carefully check their ERD often produce diagrams of poor quality, which of course should be avoided. The basic idea is to go back to the original documents and make sure that the structure represented in the ERD can satisfy the requirements. For example,the representations in the ERD must be able to reproduce any forms or reports required.

Step 4 - Check the Model (Cont) The designed er model has M:N connectivity and there are some attributes that should be added to the entities such as QTY, EXT, Total. We can fix M:N connectivity by used composite entity. Examination of the Order Entry Form shows that there are three items that are not represented on the ERD: EXT, TOTAL, and QTY. Both EXT, which is short for Extended, and TOTAL can be computed, so it is not necessary to store these in the database, or represent them on the ERD.

Step 4 - Check the Model (Cont) Unlike EXT and TOTAL, QTY (Quantity) can not be computed, and therefore must be stored in the database. Once the analyst decides that QTY should be represented on the ERD, the question becomes how to represent it. Initial ideas might include representing QTY as an attribute of ORDER, or of PRODUCT. However, QTY is not really an attribute of either of these, but is properly represented as an attribute of the relationship between ORDER and PRODUCT.

Step 4 - Check the Model (Cont) Fixed M:N Connectivity

Step 4 - Check the Model (Cont) Final ERD

Supertype/subtype relationships

Disjoint and Overlapping Constraints Disjoint subtypes Also called nonoverlapping subtypes Subtypes that contain unique subset of supertype entity set Overlapping subtypes Subtypes that contain nonunique subsets of supertype entity set

Overlapping subtypes

Completeness Constraint Partial completeness Symbolized by a circle over a single line Some supertype occurrences are not members of any subtype Total completeness Symbolized by a circle over a double line Every supertype occurrence must be member of at least one subtype

Fan Traps Represented in a way not consistent with the real world Design trap occurs when relationship is improperly or incompletely identified Represented in a way not consistent with the real world Most common design trap is known as fan trap Fan trap occurs when one entity is in two 1:M relationships to other entities Produces an association among other entities not expressed in the model