CS 405G: Introduction to Database Systems

Similar documents
EECS 647: Introduction to Database Systems

Data Modeling Using the Entity-Relationship (ER) Model

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Overview of Database Design Process. Data Modeling Using the Entity- Relationship (ER) Model. Two main activities:

Entity Relationship Data Model. Slides by: Shree Jaswal

Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model

Chapter Outline. Note 1. Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Definition. 02. Data Modeling. Example ABC Company Database. Data Modeling Importance

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

Chapter 3. Data Modeling Using the Entity-Relationship (ER) Model (from E&N and my editing)

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Database Systems ER Model. A.R. Hurson 323 CS Building

Data Modeling Using the Entity-Relationship Model

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Relational Database Design Part I. Announcements (September 5) Relational model: review. CPS 116 Introduction to Database Systems

Conceptual Data Models for Database Design

Lecture3: Data Modeling Using the Entity-Relationship Model.

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Data Modeling Using the Entity- Relationship Model Design & Analysis of Database Systems

CS 2451 Database Systems: Entity-Relationship (ER) Model Algebra

A l Ain University Of Science and Technology

Relational Database Design Part I. Announcement. Relational model: review. CPS 116 Introduction to Database Systems

Sahaj Computer Solutions. Data Modeling using the Entity Relationship Model

DATABASE DESIGN I - 1DL300

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

A l Ain University Of Science and Technology

Conceptual modeling is a very important phase in

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Announcement. Relational Database Design Part I. Keys. Relational model: review. Schema vs. data. More examples of keys

CSE 880:Database Systems. ER Model and Relation Schemas

Database Design Using E/R Model

CS 146 Database Systems

Database Management System (15ECSC208) UNIT I: Chapter 1: Introduction to DBMS and ER-Model

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Database Management Systems

Intro to DB CHAPTER 6

Relational Database Systems Part 01. Karine Reis Ferreira

Conceptual Data Modeling

DATABASE DESIGN I - 1DL300

Conceptual Modeling in ER and UML

CS3200 Database Design Spring 2018 Derbinsky. Entity-Relationship (ER) Diagrams. Lecture 7

MIT Database Management Systems Lesson 03: Entity Relationship Diagrams

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

E-R Diagram. Bagian I Entity Concept

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

DATABASTEKNIK - 1DL116

Chapter 6: Entity-Relationship Model

DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL. 1 Powered by POeT Solvers Limited

DATABASE DESIGN PROCESS

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Represent entities and relations with diagrams

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1

MIS Database Systems Entity-Relationship Model.

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

II. Review/Expansion of Definitions - Ask class for definitions

CS352 Lecture - The Entity-Relationship Model

course 3 Levels of Database Design CSCI 403 Database Management Mines Courses ERD Attributes Entities title 9/26/2018

Elements of the E-R Model

Entity-Relationship Model

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

Database Applications (15-415)

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Chapter 7: Entity-Relationship Model

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

Chapter 6: Entity-Relationship Model

II. Data Models. Importance of Data Models. Entity Set (and its attributes) Data Modeling and Data Models. Data Model Basic Building Blocks

Chapter 6: Entity-Relationship Model

Review The Big Picture

Chapter 2: Entity-Relationship Model

DATABASE SYSTEMS. Chapter 5 Entity Relationship (ER) Modelling DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

Advance Database Management System

DATABASDESIGN FÖR INGENJÖRER F

Conceptual Data Modeling Using E-R Models. PM Jat

2. E-R Model. Entity Sets Relationship Sets Attributes

CMP-3440 Database Systems

DATABASE TECHNOLOGY. Spring An introduction to database systems

Chapter 7: Entity-Relationship Model

Objectives Definition iti of terms Importance of data modeling Write good names and definitions for entities, relationships, and attributes Distinguis

Translating an ER Diagram to a Relational Schema

COSC344 Database Theory and Applications. σ a= c (P) S. Lecture 4 Relational algebra. π A, P X Q. COSC344 Lecture 4 1

Chapter 7: Entity-Relationship Model

COMP Instructor: Dimitris Papadias WWW page:

MIT Database Management Systems Lesson 03: ER-to-Relational Mapping

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

CSCC43H: Introduction to Databases

EECS 647: Introduction to Database Systems

Unit 2 - Data Modeling. Pratian Technologies (India) Pvt. Ltd.

Database Management Systems LECTURE NOTES 2

Task: Design an ER diagram for that problem. Specify key attributes of each entity type.

ER Model Overview. The Entity-Relationship Model. Database Design Process. ER Model Basics

The Entity Relationship Model

Chapter 7: Entity-Relationship Model

KINGDOM OF SAUDI ARABIA-JAZAN UNIVERSITY COLLEGE OF COMPUTER SCIENCE & INFORMATION SYSTEMS 221 INFS 3 DATABASE SYSTEMS-1 REVIEW QUESTIONS

IS 263 Database Concepts

Entity-Relationship Models

Transcription:

CS 405G: Introduction to Database Systems Entity Relationship Model Jinze Liu 9/11/2014 1 CS685 : Special The UNIVERSITY Topics in Data of Mining, KENTUCKY UKY

Review A database is a large collection of integrated data A miniworld is some aspect of the real word, described by facts (data) 9/11/2014 2

Topics Database design ER Model Entities and Attributes Entity Types, Value Sets, and Key Attributes Relationships and Relationship Types Weak Entity Types Roles and Attributes in Relationship Types ER Diagrams Notation 9/11/2014 3

Database Design Understand the mini world being modeled Specify it using a database design model A few popular ones are: Entity/Relationship (E/R) model UML (Unified Modeling Language) Intuitive and convenient But not necessarily implemented by DBMS Translate specification to the data model of DBMS Relational, XML, object oriented, etc. Create DBMS schema 9/11/2014 4

Database Design 9/11/2014 5

A Database Design Example The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location. We store each EMPLOYEE s social security number, address, salary, sex, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee. 9/11/2014 6

An Database Design Example The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location. We store each EMPLOYEE s social security number, address, salary, gender, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, gender, birthdate, and relationship to employee. 9/11/2014 7

9/11/2014 8

9/11/2014 9

Entity relationship (E/R) model Historically and still very popular Can think of as a watered down objectoriented design model Primarily a design model not directly implemented by DBMS Designs represented by E/R diagrams there are other styles Very similar to UML diagrams 9/11/2014 10

Entities and Attributes Entity: A specific object or thing in the mini world that is represented in the database. For example, the EMPLOYEE John Smith, the Research DEPARTMENT, the ProductX PROJECT. Attributes: properties used to describe an entity. For example, an EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate A specific entity will have a value for each of its attributes. For example, a specific employee entity may have Name='John Smith', SSN='123456789', Address ='731 Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55' 9/11/2014 11

Types of Attributes Simple vs. Composite Attributes Simple: Each entity has a single atomic value for the attribute. For example, SSN or Sex. Composite: The attribute may be composed of several components. For example, Name (FirstName, MiddleName, LastName). 9/11/2014 12

Types of Attributes (cont.) Single valued vs. Multi valued. Single valued: an entity may have at most one value for the attribute Multi valued: An entity may have multiple values for that attribute. For example, PreviousDegrees of a STUDENT. {PreviousDegrees}. NULL values What if the student does not hold a previous degree? What if the student has a previous degree but the information is not provided? Apartment number in an address 9/11/2014 13

Types of Attributes (cont.) Stored vs. derived Number of credit hours a student took in a semester GPA of a student in a semester 9/11/2014 14

Key Attributes Entities with the same basic attributes are grouped or typed into an entity type. For example, the EMPLOYEE entity type or the PROJECT entity type. An attribute of an entity type for which each entity must have a unique value is called a key attribute of the entity type. For example, SSN of EMPLOYEE. A key attribute may be composite. An entity type may have more than one key. 9/11/2014 15

SUMMARY OF ER DIAGRAM NOTATION Symbol Meaning ENTITY TYPE ATTRIBUTE KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE DERIVED ATTRIBUTE 9/11/2014 16

A Database Design Example The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location. We store each EMPLOYEE s social security number, address, salary, sex, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee. 9/11/2014 17

Summary (cont.) 9/11/2014 18

Relationships A relationship relates two or more distinct entities with a specific meaning. For example, EMPLOYEE John Smith works on the ProductX PROJECT or EMPLOYEE Franklin Wong manages the Research DEPARTMENT. Relationships of the same type are grouped or typed into a relationship type. For example, the WORKS_ON relationship type in which EMPLOYEEs and PROJECTs participate, or the MANAGES relationship type in which EMPLOYEEs and DEPARTMENTs participate. The degree of a relationship type is the number of participating entity types. Both MANAGES and WORKS_ON are binary relationships. 9/11/2014 19

Instances of a relationship EMPLOYEE WORKS_FOR DEPARTMENT e 1 r 1 d 1 e 2 e 3 e 4 e 5 e 6 r 2 r 3 r 4 r 5 d 2 d 3 e 7 r 6 r 7 9/11/2014 20

Structural Constraints (I) Maximum Cardinality One to one (1:1) One to many (1:N) or Many to one (N:1) Many to many 9/11/2014 21

Many to one (N:1) RELATIONSHIP EMPLOYEE WORKS_FOR DEPARTMENT e 1 r 1 d 1 e 2 e 3 e 4 e 5 e 6 r 2 r 3 r 4 r 5 d 2 d 3 e 7 r 6 r 7 9/11/2014 22

Many to many (M:N) RELATIONSHIP EMPLOYEE WORKS_FOR DEPARTMENT r 9 e 1 r 1 p 1 e 2 r 2 e 3 e 4 e 5 e 6 r 3 r 4 r 5 p 2 p 3 e 7 r 6 r r 7 8 9/11/2014 23

More Examples Each student may have exactly one account. Each faculty may teach many courses Each student may enroll many courses Students Own UKY Accounts Courses TaughtBy Instructors Students Enroll Courses 9/11/2014 24

Structural Constraints (II) Minimum Cardinality (also called participation constraint or existence dependency constraints) Zero (partial participation) One or more (total participation) 9/11/2014 25

Roles in relationships An entity set may participate more than once in a relationship set May need to label edges to distinguish roles Examples People are married as husband and wife; label needed People are roommates of each other; label not needed husband Roommate Persons Marry 9/11/2014 26 wife

Recursive relationship We can also have a recursive relationship type. Both participations are same entity type in different roles. For example, SUPERVISION relationships between EMPLOYEE (in role of supervisor or boss) and (another) EMPLOYEE (in role of subordinate or worker). In ER diagram, need to display role names to distinguish participations. 9/11/2014 27

An Database Design Example The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location. We store each EMPLOYEE s social security number, address, salary, sex, and birthdate. Each employee works for one department but may work on several projects. We keep track of the number of hours per week that an employee currently works on each project. We also keep track of the direct supervisor of each employee. Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee. 9/11/2014 28

9/11/2014 29

Weak Entity Types A weak entity is an entity that does not have a key attribute A weak entity must participate in an identifying relationship type with an owner or identifying entity type Entities are identified by the combination of: A partial key of the weak entity type The particular entity they are related to in the identifying entity type Example: Suppose that a DEPENDENT entity is identified by the dependent s first name and birthdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a weak entity type with EMPLOYEE as its identifying entity type via the identifying relationship type DEPENDENT_OF 9/11/2014 30

Weak Entity Set Rules A weak entity set has one or more many one relationships to other (supporting) entity sets. Not every many one relationship from a weak entity set need be supporting. The key for a weak entity set is its own underlined attributes and the keys for the supporting entity sets. E.g., player number and team name is a key for Players in the previous example. 31

9/11/2014 32

9/11/2014 33