Entity Relationship Diagram Farrokh Alemi Ph.D. Francesco Loaiza, Ph.D. J.D. Vikas Arya.

Slides:



Advertisements
Similar presentations
ER Model For a college DB
Advertisements

Chapter 10: Designing Databases
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
ENTITY RELATIONSHIP MODELLING
8 June Single table database in normal form Fields and records Normal form 1.Header in the first line 2.Same content for every field 3.Each record.
1 Basic DB Terms Data: Meaningful facts, text, graphics, images, sound, video segments –A collection of individual responses from a marketing research.
Databases and Processing Modes. Fundamental Data Storage Concepts and Definitions What is an entity? An entity is something about which information is.
“DOK 322 DBMS” Y.T. Database Design Hacettepe University Department of Information Management DOK 322: Database Management Systems.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
LOGICAL DATABASE DESIGN
Entity/Relationship Modelling
Database Relationships Objective 5.01 Understand database tables used in business.
Databases. Objectives Define what a database is. Understand the difference between a flat and relational database Design and create a relational database.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
Microsoft Access Understanding Relationships Academic Health Center Training (352)
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
MIS 301 Information Systems in Organizations Dave Salisbury ( )
HNDComputing – DeMontfort University  DeMontfort University 2011 Database Fundamentals wk2 Database Design ConceptsDatabase Design Concepts Database Design.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Database Management COP4540, SCS, FIU Relational Model Chapter 7.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Information Systems & Databases 2.2) Organisation methods.
IST 220 – Intro to Databases Analyzing Data Needs.
HSC IT Center Training University of Florida Microsoft Access Understanding Relationships Health Science Center IT Center – Training
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
Database Fundamentals CSC105 Furman University Peggy Batchelor.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Lesson 2: Designing a Database and Creating Tables.
Information Access Mgt09/12/971 Entity-Relationship Design Information Level Design.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
MIS2502: Data Analytics Relational Data Modeling
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Link tables and keys Access/IPS Walsall College of Arts & Technology.
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
Data Modeling (Entity Relationship Diagram) Farrokh Alemi, Ph.D. Updated by Janusz Wojtusiak (Fall 2009)
Microsoft Access CS 110 Fall Entity Relationship Model Entities Entities Principal data object about which information is to be collectedPrincipal.
HSC IT Center Training University of Florida Microsoft Access Relationships Health Science Center IT Center – Training
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant EPS
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.
Data Modeling (Entity Relationship Diagram)
Microsoft Office Access 2010 Lab 1
Databases Chapter 16.
Introduction to Database Systems
Databases and Information Management
Normalization of Databases
Relational Database Model
Creating Tables & Inserting Values Using SQL
Databases and Information Management
Relationships as Primary & Foreign Keys
Normalization Organized by Farrokh Alemi, Ph.D.
Database Design Hacettepe University
Microsoft Access Understanding Relationships
ICT Database Lesson 2 Designing a Database.
HCSI 709: Healthcare Databases
MIS2502: Data Analytics Relational Data Modeling 2
G061 - Data Dictionary.
Database Design Chapter 7.
Presentation transcript:

Entity Relationship Diagram Farrokh Alemi Ph.D. Francesco Loaiza, Ph.D. J.D. Vikas Arya

2 Objective How to construct an Entity Relationship (ER) Diagram How to construct an Entity Relationship (ER) Diagram –An example A dialogue between a student and the instructor

I Don't Understand! I Don't Understand! Can you give me an example?

Purpose of ER Diagrams To describe the structure of the database

ER diagram? What is it?

Definition of ER Diagrams ER diagram is a list of entities and their relationship to each other

Definition of Entity Anything about which we want to keep persistent data

8 From Logical to Physical EntityAttributesValuesTableFieldsData

Jargon? Why is it important?

Design of Large Databases ER diagrams make it possible to have large databases

Logically missing data? What do you mean?

12 Logically Missing Data When users have to leave a field as blank because it is not appropriate for the record –For example, if the patient's visit was about asthma, and we record data on hypertension

Duplication wastes effort

14 Redundant Data In every visit you would need all information about the patient (e.g. contact information, insurance information, etc.) In every visit you would need all information about the patient (e.g. contact information, insurance information, etc.) This leads to redundant patient data on each record

Multiple Tables Reduce Inefficiencies ER diagram leads to specification of multiple tables

Recognizing Entities Use case and description of database functions

17 Electronic Medical Record An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. It is also used to bill the patient about treatment they have received."

Looking for Entities Examine statements about uses of EMR database

19 I See Two Entities An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. It is also used to bill the patient about treatment they have received."

20 More Entities An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. An EMR is used by a provider of care to record information about the patient's visit so that the treatment can be coordinated over time with other providers. It is also used to bill the patient about treatment they have received."

21 Diagnosis Patient Treatment Diagnosis is about Patients? Other facts

Depends on More Than Patients No. Diagnosis is not a stable fact about the patient. It shows the condition of the patient at a point in time, during the visit

Treatment? Is treatment a fact about the patient?

24 Treatment Entity Code Charge Description Treatment Risk

25 Primary Key All the facts in the table are about the primary key & no other field All facts in the table should be unique for a given primary key.

Key Organizing Concept Primary key is what tables are organized around

27 Facts Belong to Primary Keys If a fact can belong to the primary key and nothing else, then it belongs to the entity If a fact can belong to the primary key and nothing else, then it belongs to the entity Otherwise it belongs to a different entity Consider address Consider address Consider diagnosis Consider diagnosis

Not Black & White Address does not belong to the patient either as it changes over time

29 Design Choices Number of Tables & Entities For our example

Art & Science Do’s and Don’ts

Patient Attributes? What fields are needed?

Social Security Number Avoid it to improve privacy

33 Primary Keys for Patient Entity Combination of fields Auto-number

34 Patient Entity Attributes Contact information Demographic data Address

Atomic Facts not Collections of Facts Address is a collection of facts

36 Patient Attributes Revised Street Date of Birth First name Patient Gende r Last name Middle initials Race Insurance number Insurance company Zip Street number city State

Provider table? What attributes should be included in the Provider table?

38 Provider Attributes Street Date of Birth First name Providers Title Last name Middle initials Year of graduation Board certification Telephone Zip Street number city State Employee ID

Treatment Entity? What attributes should be included?

40 Treatment Attributes Code Cost Description Treatment Warning Typical medication

41 Visit Table Many records Few fields

42 Visit Attributes Provider ID Patient ID Diagnosis Visit ID Date Treatment code

43 Foreign Keys Primary keys of another table Included to link to other tables

Components of ER Diagram ER Diagram Shows each entity (their attributes) and the relationship between the entities

Setting Relationships In Access you can do this by creating the tables and then connecting the tables to each other

What If What if information in one table is inadvertently deleted. Then we loose the meaning of information in other tables. What if information in one table is inadvertently deleted. Then we loose the meaning of information in other tables.

Inferential Integrity Cascaded deletion of all related records

How? How do you set inferential integrity in Access?

Cascaded Updates Updating one table will lead to the change for all other related tables

Types of Joins Matching to missing information

Join Examples? Give me an example of when you want to have this type of joins.

52 Non-clinical Providers Know if there are providers not taking care of any patients. Know if there are providers not taking care of any patients. If we stay with our match of foreign and primary key all cases with no match will be eliminated and we will not be able to see if there is a provider with no patient. If we stay with our match of foreign and primary key all cases with no match will be eliminated and we will not be able to see if there is a provider with no patient.

Relationships in Words? Is there a way of putting words to the relationship between two tables

54 Relationships in Words The words of course are implied in the field names. The words of course are implied in the field names. –If the foreign key is ID of the son, then it implies that it links the father to the son. –If the foreign key is ID of the son, then it implies that it links the father to the son. Some ER diagrams allow the specification of the relationships in words. Some ER diagrams allow the specification of the relationships in words.

55 One to One Joins A one to one relationship requires a record for each item in the other table. A one to one relationship requires a record for each item in the other table. –For example, a word and its meaning in a dictionary have a one to one relationship."

56 One to Many Joins Yes, a one to many relationship allows one record to have multiple records in another table linked to it. Yes, a one to many relationship allows one record to have multiple records in another table linked to it. –For example, the patient record may have multiple records in the visit table." –For example, the patient record may have multiple records in the visit table."

One Patient Many Visits Yes that makes sense

58 Many to Many Joins Suppose we want to allow a patient to live at two different addresses and two different patients (mother and a child) to live at same address. Suppose we want to allow a patient to live at two different addresses and two different patients (mother and a child) to live at same address. Problems: Primary keys need to be unique. Problems: Primary keys need to be unique. One way to solve this problem is to introduce a junction table One way to solve this problem is to introduce a junction table

Example of Junctions? Could you layout the example in more detail?

60 Patient & Address Junction Table

Advantage of Junctions We can have primary keys in patient and address table that are unique but have them listed in multiple ways in the junction table We can have primary keys in patient and address table that are unique but have them listed in multiple ways in the junction table

62 Patient & Patient Junction IDParentChildRelationship Mother to Mother to Father of

Allows Self Relationships This is a clever way of keeping information about primary keys in same table

64 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself

65 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself

66 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself

67 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself

68 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself

69 Take Home Lessons Definitions, including terms such as entity, attribute and values. Definitions, including terms such as entity, attribute and values. How entities can be identified. How entities can be identified. Specification of attributes Relationships among tables using foreign and primary keys. Relationships among tables using foreign and primary keys. Types of relationships and inferential integrity. Types of relationships and inferential integrity. Junction table can be used to represent many to many relations and relationships between the table and itself