Entity Relationship Diagrams and Relational DBs BSAD 141 Dave Novak.

Slides:



Advertisements
Similar presentations
Entity Relationship (ER) Modeling
Advertisements

Entity Relationship (E-R) Modeling
Database Design DB Chapter 5 J.G. Zheng June 29th 2005.
Database Design J.G. Zheng May 19 th Overview Entity Relationship Modeling Data modeling using Entity Relationship Diagram (ERD) Transforming.
Conceptual / semantic modelling
Information Systems Today: Managing in the Digital World
Database Design Process
Chapter 10: Designing Databases
Access Tables 1. Creating a Table Design View Define each field and its properties Data Sheet View Essentially spreadsheet Enter fields You must go to.
the Entity-Relationship (ER) Model
Lecture plan Outline of DB design process Entity-relationship model
Entity-Relationship (ER) Modeling
Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques
Introduction to MS Access, building tables, creating keys, creating relationships BSAD 141 Dave Novak.
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
Entity Relationship (ER) Modeling
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
MIS 210 Fall 2004Sylnovie Merchant, Ph. D. Lecture 4: Data Modeling Process Modeling MIS 210 Information Systems I.
Database Design & Mapping
System Analysis - Data Modeling
Agenda for Week 1/31 & 2/2 Learn about database design
The Relational Database Model:
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
3 The Relational Model MIS 304 Winter Class Objectives That the relational database model takes a logical view of data That the relational model’s.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
1 © Prentice Hall, 2002 CMIS564: E/R Modeling Dr. Bordoloi Based on Chapter 3; Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
3.1 CSIS 3310 Chapter 3 The Entity-Relationship Model Conceptual Data Modeling.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Chapter 5 Entity Relationship (ER) Modelling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
1 Database & DBMS The data that goes into transaction processing systems (TPS), also goes to a database to be stored and processed later by decision support.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
MIS2502: Data Analytics Relational Data Modeling
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Entity Relationship (E-R) Model
Logical Database Design and the Rational Model
Chapter 4: Logical Database Design and the Relational Model
Information Systems Today: Managing in the Digital World
Entity Relationship Diagrams and Relational DBs
Tables and Their Characteristics
Introduction to MS Access: creating tables, keys, and relationships
Entity Relationship Diagram
Database Systems: Design, Implementation, and Management Tenth Edition
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 3: Modeling Data in the Organization
Chapter # 4 Entity Relationship (ER) Modeling.
Presentation transcript:

Entity Relationship Diagrams and Relational DBs BSAD 141 Dave Novak

Topics Covered ERD (entity relationship diagram) Data Modeling Entity –vs- Entity set Attribute –vs- Relationship Types of attributes and their domain Characteristics of relationships Degree Connectivity Existence

Modeling Why would it be necessary or useful to model the structure of a database system?

Modeling Data Model Entity-Relationship Diagram (ERD) Popular model that focuses on data

ERD ERD: Graphical blueprint for the exact design and structure of a relational DB Shows details of things organization collects data about and how those things are related

Relational Database Management System RDBMS A very popular, widely used DBMS Made possible by modern computing power – computer must a lot of processing work User does not need to understand the underlying structure of the database

Relational Databases Based on organization of data in two- dimensional tables connected via relationships Tables are linked using a common data element (attribute) that appears in both tables By linking tables via relationships users can navigate the database and extract and combine data from different tables

Relational Databases The Table is the fundamental component in a relational database All data are divided into different tables This approach provides a much easier way to manage data Data are essentially grouped by common themes and then connected by relationships in a logical manner based on the ERD

Relational Databases A relationship is a connection between two or more simple two-dimensional tables that consist of rows (entity / records) and columns (attributes / fields) of data Each entity is a unique observation and the attributes are the common characteristics that are used to describe all the entities

Relational Databases Power of an RDBs comes from ability to quickly find and bring together data stored in separate tables using queries, forms, and reports RDBs utilize the Structured Query Language (SQL) A programming language used to manage data in a RDB

Relational Databases CLASS SECTION Table

Review What is the entity set represented here? What is an example of an entity within the entity set? What are some of the attributes of the entity? Why is the first field – Employee ID – underlined?

Primary Keys Each record/entity must have a attribute (field/column) or set of attributes that uniquely identifies that specific entity from all the other entities stored in the table The unique attribute (or set of attributes) is called the primary key

Primary Keys For our purposes: ALL relational DB tables must have a primary key ALL entities within the table must have a unique primary key value The primary can be created by you Doesnt have to provide value-added information Can be a combination of fields/attributes Can be sequential numbers Can be a combination of letters and numbers Cannot be repeated or left blank for an entity

Review Key Terminology Entity Set / Table (has a name that directly relates to the primary information stored in the table) Entity / Record (this is a row in a table) Attribute / Field (this is a column in the table that describes a characteristic of the entity) Relationship (an association or linkage between two (+) tables)

Different Types of Attributes Simple –vs- composite Single valued –vs- multi-valued

Attribute Domain The collection or range of all possible allowable values an attribute may take on EmpDOB: list of all valid employee birth NumDependents: positive integers from 0 to 15 Height: positive real numbers between 36.0 and 84.0 inches. UnionMember: logical yes (true) or no (false) EmpSSN: list of valid social security numbers

Value for Each Attribute Each data attribute takes on a specific value: One particular instance of an entitys attribute e.g. Employee attributes: EmpSSNEmpDOBNumDependentsUnionmemberHeight

Relationships Entities are connected to one another via relationships The association between two or more entities We will discuss three (3) important characteristics of relationships: 1) Degree 2) Connectivity 3) Existence

Relationship Degree Loosely equal to the number of entities involved in a particular relationship Could also view this more simplistically as the number of tables linked by each relationship 1= Unary (aka recursive) 2= Binary 3= Ternary

Relationship Connectivity Three types of connectivity relationships are used to describe associations between the entities in different tables How are entities logically connected in the DB? 1) One-to-Many 2) Many-to-Many 3) One-to-One

Relationship Connectivity Employee #1 Employee #2 Employee #3 Company Vehicle #1 Company Vehicle #2 Company Vehicle #3 1:1 This relationship connectivity shows that each employee can be associated with only one company vehicle and that each company vehicle can be associated with only one employee. In this case, the RDB will be structured in a manner that matches a specific employee to a specific company car each and every day. Each car would be explicitly linked to a particular employee 1 1 Employee Vehicle

Relationship Connectivity Employee #1 Employee #2 Employee #3 Employee #4 Accounting Department Human Resources Dept M This relationship connectivity shows that each employee can be associated with only one organizational department (employees cannot simultaneously be assigned to, or work in, two different departments). However, each department can be staffed with many / multiple employees 1 1:M Employee Department

Relationship Connectivity Customer #1 Customer #2 Customer #3 Product #1 Product #2 Product #3 Product #4 M:M This relationship connectivity shows that customer can be associated with many different products and that each product can be associated with many different customers This relationship will be modeled in a special way!! M M Customer Product

Relationship Connectivity One-to-Many relationship A professor can teach many different class sections Each class section is taught by only one professor A customer account can contain many invoices Each invoice is associated with only one customer account

Relationship Connectivity One-to-Many example Relationship is labeled 1:M Professor Class Section Each teaches M Each is taught by 1 Read: left to right on the top of the line Read: right to left on the bottom of the line

Relationship Connectivity Many-to-Many relationship Employee has many job skills Each job skill can be learned by many employees Student can take many class section Each class section can be taken by many students

Relationship Connectivity One-to-One relationship Employee is assigned to one Company Car Each Company Car is assigned to only one employee

Relationship Connectivity Why does this matter? Logically the relationship needs to make sense Dont want the database functionality to allow relationships that are not feasible or practical From a practical perspective, the foreign key always goes on the many side of the relationship – need to get this correct Special implementation of M:M & 1:1

Relationship Existence Denotes whether participation in a relationship is required (or not), and the minimum and maximum number of entities that participate in a particular relationship Mandatory: The existence of one entity depends on the existence of another entity Optional: The existence of one entity is independent of the existence of another entity

Mandatory Relationship Existence Example Employee #1 Employee #2 Employee #3 Employee #4 Accounting Department Human Resources Dept 1:M The existence of an instance of employee (an individual employee) depends on the existence of a department where the employee will be assigned In this case, the entity set Department will need to be populated before the entity set Employee is populated Employee Department

Optional Relationship Existence Example Employee #1 Employee #2 Employee #3 Employee #4 Accounting Department Human Resources Dept 1:M The existence of an instance of employee (an individual employee) is independent of the existence of a department where the employee will be assigned In this case, the entity instance employee #4 can be created without the need to assign that employee to a department Employee Department

Relationship Existence Example CRN 5099 CRN 5060 CRN 5061 CRN 5062 BSAD 141 BSAD 173 BSAD 120 1:M Discuss… Course Section Course

Investigating Relationships 1:M relationship This relationship states that each supplier can provide (or distributes) many different products (1, 2, … n), but each individual product is provided by (or distributed by) only one supplier In this case, the structure would not allow a specific product to be provided by (or distributed by) to more than one supplier Supplier Product Can provide M Is provided by 1

Supplier Product Can provide M Is provided by 1 Supplier IDCompany NameContact NameContact TitleAddressCityRegionPostal CodeCountryPhone 2 New Orleans Cajun DelightsShelley Burke Order Administrator P.O. Box New OrleansLA70117USA (100) Grandma Kelly's HomesteadRegina Murphy Sales Representative707 Oxford Rd.Ann ArborMI48104USA (313) Bigfoot BreweriesCheryl Saylor Regional Account Rep th Avenue Suite 210BendOR97101USA (503) Supplier Table

Supplier Product Can provide M Is provided by 1 Product Table Product IDProduct Name Supplier IDCategory Quantity Per Unit Unit Price Units In Stock Units On Order Reorder Level 7 Uncle Bob's Organic Dried Pears3Seafood lb pkgs.$ Northwoods Cranberry Sauce3 Condiment s oz jars$ Chef Anton's Cajun Seasoning2 Condiment s oz jars$ Chef Anton's Gumbo Mix2 Condiment s36 boxes$ Sasquatch Ale16Beverages oz bottles$ Steeleye Stout16Beverages oz bottles$ Louisiana Fiery Hot Pepper Sauce2 Condiment s oz bottles$ Louisiana Hot Spiced Okra2 Condiment s oz jars$

Product Table Product IDProduct Name Supplier IDCategory Quantity Per Unit Unit Price Units In Stock Units On Order Reorder Level 7 Uncle Bob's Organic Dried Pears3Seafood lb pkgs.$ Northwoods Cranberry Sauce3 Condiment s oz jars$ Chef Anton's Cajun Seasoning2 Condiment s oz jars$ Chef Anton's Gumbo Mix2 Condiment s36 boxes$ Sasquatch Ale16Beverages oz bottles$ Steeleye Stout16Beverages oz bottles$ Louisiana Fiery Hot Pepper Sauce2 Condiment s oz bottles$ Louisiana Hot Spiced Okra2 Condiment s oz jars$ Notice that SupplierID is not an attribute of Product – it is the PK of the Supplier table and will be the FK (to the Supplier table) in the Product table

Product IDProduct Name Supplier IDCategory Quantity Per Unit Unit Price Units In Stock Units On Order Reorder Level 7 Uncle Bob's Organic Dried Pears3Seafood lb pkgs.$ Northwoods Cranberry Sauce3 Condiment s oz jars$ Chef Anton's Cajun Seasoning2 Condiment s oz jars$ Chef Anton's Gumbo Mix2 Condiment s36 boxes$ Sasquatch Ale16Beverages oz bottles$ Steeleye Stout16Beverages oz bottles$ Louisiana Fiery Hot Pepper Sauce2 Condiment s oz bottles$ Louisiana Hot Spiced Okra2 Condiment s oz jars$ Supplier IDCompany NameContact NameContact TitleAddressCityRegionPostal CodeCountryPhone 2 New Orleans Cajun DelightsShelley Burke Order Administrator P.O. Box New OrleansLA70117USA (100) Grandma Kelly's HomesteadRegina Murphy Sales Representative707 Oxford Rd.Ann ArborMI48104USA (313) Bigfoot BreweriesCheryl Saylor Regional Account Rep th Avenue Suite 210BendOR97101USA (503)

Investigating Relationships The 1:M relationship example The Supplier ID attribute in the Product table is a foreign key that links the individual products in the Product table to a specific supplier in the Supplier table

Learning Outcomes 1. Describe the differences between ERDs and DFDs 2. Describe importance of relational DBs 3. Familiar with all terminology: tables, relationships, entities, attributes, keys, etc 4. Understand how to implement a relationship 5. Discuss / define the 3 characteristics of relationships