Introduction to Data Modeling

Slides:



Advertisements
Similar presentations
Chapter # 4 BIS Database Systems
Advertisements

Entity Relationship (ER) Modeling
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
Modern Systems Analysis and Design Third Edition
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Chapter 10 Structuring System Requirements: Conceptual Data Modeling.
WELL-DESIGNED DATABASES Process faster Easy to develop and maintain Easy to read and write code.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
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?
Introduction to Data Modeling CS 146. What is a Data Model?  Definition: precise description of the data content in a system  Types of data models:
Modern Systems Analysis and Design Third Edition
APPENDIX C DESIGNING DATABASES
Entity-Relationship Design
Yong Choi School of Business CSUB
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
ZEIT2301 – Database Design Entity-Relationship Diagrams
Data Modeling ERM ERD.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
Chapter 5 Entity Relationship (ER) Modelling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Concepts and Terminology Introduction to Database.
G057 - Lecture 02 Introduction To Database System Concepts Mr C Johnston ICT Teacher
IMS 6217: Primary Key Reference 1 Dr. Lawrence West, MIS Dept., University of Central Florida Primary Keys Uniqueness of Table Rows Identifier.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
Database Design 1: Introduction and Terminology CS 320.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
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 
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
Database Design 3: Advanced Data Modeling Concepts CS 320.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Data Modeling Using the Entity-Relationship (ER) Model.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
© 2005 by Prentice Hall 1 The Database Development Process Dr. Emad M. Alsukhni The Database Development Process Dr. Emad M. Alsukhni Modern Database Management.
Database Design 2: Creating an ER Model
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.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Database Basics BCIS 3680 Enterprise Programming.
INTRODUCTION TO DATABASE DESIGN. Definitions Database Models: Conceptual, Logical, Physical Conceptual: “big picture” overview of data and relationships.
advanced data modeling
Information Access Mgt09/12/971 Entity-Relationship Design Information Level Design.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
INTRODUCTION TO DATA MODELING CS 260 Database Systems.
Modern Systems Analysis and Design Third Edition
More Data Modeling CS 146. Relationship Lower Bounds  Lower bound: minimum number of related instances in a relationship  Value is typically 0 or 1.
Database Design 4: Deriving Tables From Data Models CS 320.
DERIVING TABLES FROM MODELS CS 260 Database Systems.
Data Modeling and Entity-Relationship Model I
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Tables and Their Characteristics
Database Design – Lecture 4
CSCI-100 Introduction to Computing
Database Systems: Design, Implementation, and Management Tenth Edition
Database Modeling using Entity Relationship Model (E-R Model)
ER MODELING Instructor: SAMIA ARSHAD
Presentation transcript:

Introduction to Data Modeling CS 146

What is a Data Model? Definition: precise description of the data content in a system Types of data models: Conceptual: describes WHAT the system contains Logical: describes HOW the system will be implemented, regardless of the DBMS Physical: describes HOW the system will be implemented using a specific DBMS

Why do we need to create data models? To aid in the development of a sound database design that does not allow anomalies or inconsistencies Goal: to create database tables that do not contain duplicate data values that can become inconsistent

Types of Data Models Entity-Relationship (E-R) Models Only addresses data and relationships Classic, simplest Best for deriving a sound table design Many extensions/variations exist Basis for most other modeling approaches UML (unified modeling language) Class models Goes beyond data, also models behaviors

Creating an Entity-Relationship Model Identify entities Identify entity attributes and primary keys Specify relationships

Data Entities Entity A "thing" about which you want to store data in an application Multiple examples (instances) of the entity must exist Goal: Store data about each entity in a separate table Do not store duplicate data in multiple tables or records Examples: CUSTOMER, PRODUCT

Data Entity Instances Entity instance A specific occurrence (data value) of an entity An entity must have multiple entity instances or it is not really an entity! Examples: Bobby Bon Bons, Celestial Cashew Crunch

ER Model Attributes Attribute Attribute value A characteristic (data field) of an entity that you want to store in the database Examples: CUST_ID, PROD_DESC Attribute value The value of a particular attribute for a particular entity instance Examples: 1, "Nuts Not Nachos"

ER Model Notation Represent entities as rectangles List attributes within the rectangle Entity Primary key Attributes

Data Model Naming Conventions Entity names are short, descriptive, compound word singular nouns UWEC_STUDENT, CANDY_PRODUCT, Entity names will ultimately correspond to table names Why singular? Makes more sense when you start talking about relationships

Data Model Naming Conventions (continued) Attribute names are descriptive compound words that correspond to the entity name Attribute names will ultimately correspond to field names Every attribute name within the database should be unique

Specific DBMS Naming Conventions Oracle, MySQL: words separated by underscores EMPLOYEE, EMPLOYEE_NAME, candy_product Why? Oracle forces all object names to upper-case letters, MySQL forces all names to lower-case on Windows SQL Server: Use mixed case Employee, EmployeeName Preserves mixed-case notation To be safe, always separate words with underscores!

Attributes Selection Issues Primary key Atomic Composite Multi-valued Derived

Primary Key Attributes Attribute whose value is unique for every entity instance Every entity MUST have a PK Designate by: Placing as first attribute in the entity Underline Label using "PK"

Selecting Primary Keys Must be values that are: Unique for every possible record Do not change Best practice: numeric with no blank spaces or formatting characters Often you need to create a surrogate key ID value that serves only to identify the object in the database Exception: objects with "natural" primary keys SKU ISBN VIN

Atomic and Composite Attributes Atomic attribute: represents a single data value 15, "Joline", 12/25/2009 Composite attribute: can be decomposed into atomic attributes "James B. Brown" "5580 Pinewood Road, Eau Claire, WI 54701" Should you ever allow a composite attribute in a database?

Composite Attributes Decompose into atomic components for: Sorting Searching Formatting Student_First_Name Student_MI Student_Last_Name Student Student_ID Student_Name Student_Address Student_DOB Student_Class Student_Address_Line_1 Student_Address_Line_2 Student_City Student_State Student_Country Student_Postal_Code

Multi-Valued Attributes Can have multiple values for the same entity Student Student_ID (PK) Student_First_Name Student_Last_Name Student_Address Student_DOB Student_Class Student_Phone1 Student_Phone2 Employee Employee_ID (PK) Employee_First_Name Employee_Last_Name Employee_Address Employee_DOB Employee_Dependent1 Employee_Dependent2

Handling Multi-valued Attributes If it has a definite maximum number, leave as a repeating attribute If the upper limit is variable, make a new entity Student Student_ID Student_First_Name Student_Last_Name Student_Address Student_DOB Student_Class Student_Phone1 Student_Phone2 Employee Employee_ID Employee_First_Name Employee_Last_Name Employee_Address Employee_DOB Employee_Dependent1 Employee_Dependent2 Dependent Dependent_ID Dependent_Name has

Derived Attributes Value that can be derived from other attributes Student_Age = 22 (DOB = 11/20/1986, current date is 11/13/2009) Order_Total = $500 (Item 1 cost = $200, Item 2 cost = $300)

Handling Derived Attributes Store the underlying data values from which you can derive the attribute value … Examples: DOB => Age CurrentPrice and UnitsSold of an item (for a sales order) … unless the underlying values can change! PRODUCT_PRICE, COURSE_CREDITS

Data Model Relationships Specify the number of instances of one entity that can be associated with instances of a related entity Types: 1:M 1:1 M:M “M” denotes some value greater than 1 whose upper bound is undetermined This is called relationship cardinality

Example 1:M Relationship Store Store_ID Store_Name Store_Address Store_ID Store_Name Store_Address 1 Northside 3233 Wisconsin St. 2 Southside 4211 Golf Road Rents Video_ID Video_Title Video_Format 1000 The Princess Bride DVD 1001 Sideways Bluray 1002 Just Visiting 1003 Crash Video Video_ID Video_Title Video_Format

Example 1:1 Relationship Spouse Spouse_ID Spouse_Name Spouse_ID Spouse_Name 52 Ryan, Judy 53 Redmann, Rudy Has Customer Customer_ID Customer_Name Customer_Address Customer_ ID Name Customer_Address 1 Ryan, Paul 5454 Hyde Court 2 Myers, Mary 112 Birch Place

Example M:M Relationship Video Video_ID Video_Title Rents Customer Customer_ID Customer_Name Customer_Address

Example ER Model

Decomposing a Composite Relationship Can always be decomposed into 2 1:M relationships! Student StudentID StudentFirstName StudentLastName StudentAddress StudentDOB StudentClass Course CourseID CourseName CourseDay CourseTime CourseLocation EnrollsIn CourseGrade Course CourseID CourseName CourseDay CourseTime CourseLocation Student StudentID StudentFirstName StudentLastName StudentAddress StudentDOB StudentClass Enrollment EnrollmentID CourseGrade Has Has Note the direction of the 1:Ms!

Summary: The Data Modeling Process Define entities Define attributes Define relationships Identify relationship cardinality (1:1, 1:M, M:M)