MIS2502: Data Analytics Relational Data Modeling 2

Slides:



Advertisements
Similar presentations
More Diagramming & Practice with Relationship Modeling
Advertisements

Entity-Relationship (ER) Modeling
ENTITY RELATIONSHIP MODELLING
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Concepts of Database Management Seventh Edition Chapter 6 Database Design : ERD Model.
Entity Relationship (ER) Modeling
Agenda for Week 1/31 & 2/2 Learn about database design
Entity Relationship Diagrams
Ch5: Software Specification. 1 Descriptive specifications  Describe desired properties of system  Three types:
Systems Analysis and Design in a Changing World, 6th Edition
MIS2502: Data Analytics Relational Data Modeling
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
File and Database Design SYS364. Today’s Agenda WHTSA DBMS, RDBMS, SQL A place for everything and everything in its place. Entity Relationship Diagrams.
Business Process Modeling
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
INTRODUCTION TO DATABASE DESIGN. Definitions Database Models: Conceptual, Logical, Physical Conceptual: “big picture” overview of data and relationships.
advanced data modeling
MIS2502: Data Analytics Relational Data Modeling
RELATIONAL DATA MODELING MIS2502 Data Analytics. What is a model? Representation of something in the real world.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
MIS2502: Data Analytics Relational Data Modeling David Schuff
Data Modeling and Entity-Relationship Model I
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Entity Relationship (E-R) Model
COP Introduction to Database Structures
Database Design Chapters 17 and 18.
Entity Relationship Modeling
Entity/Relationship Modelling
Data Modeling Using the ERD
Entity-Relationship Model
TMC2034 Database Concept and Design
Entity Relationship Model
MIS2502: Data Analytics Relational Data Modeling
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Chapter 7: Entity-Relationship Model
Entity-Relationship Modelling
Outline of the ER Model By S.Saha
Entity-Relationship Modeling
MIS5101: Business Intelligence Relational Data Modeling
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Entity Relationship Diagram
Entity-Relationship Model and Diagrams (continued)
Module 8 – Database Design Using the E-R Model
MIS2502: Data Analytics Relational Data Modeling
Entity-Relationship Model
Database Systems: Design, Implementation, and Management Tenth Edition
Entity-Relationship Modelling
MIS2502: Data Analytics Relational Data Modeling
Database Design Chapters 17 and 18.
MIS2502: Data Analytics Relational Data Modeling
Fundamentals of Databases CSU 07203
Chapter 3: Modeling Data in the Organization
MIS2502: Data Analytics Relational Data Modeling
CHAPTER 2 - Database Requirements and ER Modeling
Chapter 4 Entity Relationship (ER) Modeling
Entity-Relationship Diagram (ERD)
MIS2502: Data Analytics Relational Data Modeling 3
Information Systems in Organizations 2. 1
Chapter 6b: Database Design Using the E-R Model
Presentation transcript:

MIS2502: Data Analytics Relational Data Modeling 2 Zhe (Joe) Deng deng@temple.edu http://community.mis.temple.edu/zdeng

The Entity Relationship Diagram (ERD) The primary way of modeling a relational database ER Diagrams --- are sketches like this one! Primary Key TUID Course number Cardinality Name Student contains Course Attribute Course Title Entity Relationship GPA

The Entity Relationship Diagram (ERD) Three main diagrammatic elements Entity A uniquely identifiable thing (i.e., person, order) Rectangle A characteristic of an entity or relationship (i.e., first name, order number) Attribute Ellipse Relationship Describes how two entities relate to one another (i.e., makes) Diamond

Last component: Cardinality Crow’s Foot Notation makes Customer Order There are other ways of denoting cardinality, but this one is pretty standard. So called because this… …looks something like this There are also variations of the crows feet notion!

(Close to relationship) Cardinality Defines the rules of the association between entities Maximum cardinality (Close to entities) makes Customer Order Minimum cardinality (Close to relationship) Maximum cardinality Describes the maximum number of entities that participate in a relationship (either or ) Minimum cardinality Describes the minimum number of entities that must participate in a relationship (either or )

Cardinality How to understand the notations: Customer Order Entity – Relationship – Cardinality – Entity makes Customer Order Minimum cardinality: at least – one at most - one at least – zero (optional) at most - many Maximum cardinality: Maxinum cardinality: One customer can have many orders. One order can only belong to one customer. Minimum cardinality: A customer could have no orders. An order has to belong to at least one customer.

Maximum and Minimum Cardinality Maximum cardinality (type of relationship) Describes the maximum number of entity instances that participate in a relationship One-to-one One-to-many Many-to-many Minimum cardinality Describes the minimum number of entity instances that must participate in a relationship Either optional or mandatory

Maximum cardinality: One-to-One Relationship A single instance of one entity is related to a single instance of another entity A state has (at most) one governor A governor governs (at most) one state

Maximum cardinality: One-to-Many Relationship One-to-Many (1:n or 1:m) A single instance of one entity is related to multiple instances of another entity most common Award Pet owner A publisher can publish many books A book is published by (at most) one publisher

Maximum cardinality: Many-to-Many Relationship Many-to-Many (n:n or m:m) Each instance of one entity is related to multiple instances of another entity, and vice versa A book can be written by many authors An author can write many books

Minimum Cardinality Minimums are generally stated as either zero or one: 0 (optional): participation in the relationship by the entity is optional. 1 (mandatory): participation in the relationship by the entity is mandatory. A programmer is mandatory for a certificate); or a certificate has to be issued to (at least) one programmer. A certificate is optional for a programmer; or a programmer may not have any certificates 1:m maximum cardinality: a programmer can have many certificates; a certificate is issued to (at most) one programmer

Minimum Cardinality + Maximum Cardinality Crow’s Foot Notation Summary Symbol Minimum Cardinality + Maximum Cardinality Optional + One Mandatory + One Optional + Many Mandatory + Many

The Order-Product Example: A Many-to-Many (m:m) Relationship An order can be composed of many products. An order has to have at least one product. A product can be a part of many orders. A product has to be associated with at least one order. Order number Order Date Order at most – many at least – one contains Quantity Does it make sense for the maximum cardinality to be 1 for either entity? Does it make sense for the minimum cardinality to be 0 (optional) for either entity? at least – one at most - many Product Product name Price Product ID

Relationship Attributes TUID Name The grade and semester describes the combination of student and course (i.e., Bob takes MIS2502 in Fall 2011 and receives a B; Sue takes MIS2502 in Fall 2012 and receives an A) Student Grade contains Semester Course Course number Course Title

Cardinality is defined by business rules What would the cardinality be in these situations? contains Order ? ? Product has Course ? ? Section has Employee ? ? Office

A scenario: The auto repair shop A car is described by a VIN, make, and model. A mechanic is described by a name and SSN. A repair is described by a price. A transaction occurs on a particular date. An invoice has an invoice number and a billing name, city, state, and zip code. Each transaction is associated with a car, a mechanic, and a repair. Cars, mechanics, and repairs can all be part of multiple transactions. Many transactions can make up an invoice. A transaction can only belong to one invoice.

Solution: Entities

Solution: EDR TIPS: ONE relationship can ONLY link TWO entities. If one needs more connections, it should be a NEW entity! (E.g., transaction, order, record, etc.)

Normalization Organizing data to minimize redundancy (repeated data) This is good for several reasons The database takes up less space Fewer inconsistencies in your data Easier to search and navigate the data It’s easier to make changes to the data The relationships take care of the rest

Normalizing your ER Model If an entity has multiple sets of related attributes, split them up into separate entities Don’t do this… Vendor Name Vendor Phone Vendor Address Vendor Name Vendor Phone Vendor Address Vendor Vendor ID Product ID Product Product name sells Price …do this  Then you won’t have to repeat vendor information for each product. Product Product name Product ID Price

Normalizing your ER Model Each attribute should be atomic – you can’t (logically) break it up any further. Don’t do this… …do this Phone Address Phone First Name Customer ID Customer First/Last Name Customer ID Customer Last Name Street City State Zip This way you can search or sort by last name OR first name, and by city, state, or zip code.

Summary of ERD Key concepts Entity Relationship Attributes Cardinality Entity attributes: primary key vs. non-key Relationship attributes Cardinality Minimum cardinality: optional or mandatory (i.e., 0 or 1) Maximum cardinality: 1:1, 1:m, m:m Crow’s foot notation Key skills Interpret simple ERDs Draw an ERD based on a scenario description

English grammar structure Mapping natural language English grammar structure ER structure Proper noun Entity Transitive verb Relationship type Adjective Attribute for entity Adverb Attribute for relationship Chen, P. P. S. (1997). English, Chinese and ER diagrams. Data & Knowledge Engineering, 23(1), 5-16.

Drawing ERD With ERDPlus: A Checklist Entities Entity attributes Primary key Non-key attributes Relationships Minimum cardinality Maximum cardinality Relationship attributes

Time for our 2nd ICA!