Jeffery S. Horsburgh Hydroinformatics Fall 2014

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

Chapter # 4 BIS Database Systems
the Entity-Relationship (ER) Model
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Fundamentals, Design, and Implementation, 9/e Chapter 3 Entity-Relationship Data Modeling: Process and Examples Instructor: Dragomir R. Radev Fall 2005.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
The Relational Database Model
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.
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.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Exercises: Organizing, Loading, and Managing Point Observations Using HydroServer Support EAR CUAHSI HIS Sharing hydrologic data
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Concepts and Terminology Introduction to Database.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 3/1 Copyright © 2004 Please……. No Food Or Drink in the class.
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 
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
In this session, you will learn to: Map an ER diagram to a table Objectives.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Database Design – Lecture 4 Conceptual Data Modeling.
Data Model / Database Implementation (continued) Jeffery S. Horsburgh Hydroinformatics Fall 2014 This work was funded by National Science Foundation Grants.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
DBMS ER model-2 Week 6-7.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
DBS201: Data Modeling. Agenda Data Modeling Types of Models Entity Relationship Model.
Welcome: To the fifth learning sequence “ Data Models “ Recap : In the previous learning sequence, we discussed The Database concepts. Present learning:
Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant EPS
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.
1 of 42 Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National Science Foundation Grants EPS
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Entity Relationship Modeling
- The most common types of data models.
Database Systems: Design, Implementation, and Management Tenth Edition
Business System Development
TMC2034 Database Concept and Design
Systems Analysis and Design
The Relational Database Model
Databases Chapter 16.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Lecture 6 Data Model Design (continued)
Using Structured Query Language (SQL) (continued)
Lecture 8 Database Implementation
Tables and Their Characteristics
Database Design – Lecture 4
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
Data Models.
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
CS 174: Server-Side Web Programming February 12 Class Meeting
Entity Relationship Diagrams
Chapter 4 Entity Relationship (ER) Modeling
Entity-Relation Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
MIS2502: Data Analytics Relational Data Modeling
Data Model.
Database Systems Instructor Name: Lecture-9.
Review of Week 1 Database DBMS File systems vs. database systems
The Relational Database Model
Chapter 4 Entity Relationship (ER) Modeling
Entity-Relationship Diagram (ERD)
Chapter 10 Structuring System Requirements: Conceptual Data Modeling
Chapter # 4 Entity Relationship (ER) Modeling.
Lecture 10 Structuring System Requirements: Conceptual Data Modeling
Presentation transcript:

Jeffery S. Horsburgh Hydroinformatics Fall 2014 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2014 This work was funded by National Science Foundation Grants EPS 1135482 and EPS 1208732

Objectives Identify and describe important entities and relationships to model data Develop data models to represent, organize, and store data Design and use relational databases to organize, store, and manipulate data

Data Modeling Goal – make sure all data objects required by a database are completely and accurately represented Data model design – the blueprint for creating a physical implementation of a database

Data Modeling Terms Entity – a class of real world objects having common attributes (e.g., sites, variables, methods). Attribute – A characteristic or property of an entity (site name, latitude, longitude) Relationship – an association between two or more entities Cardinality – the number of entities on either end of a relationship (one-to-one, one-to-many, many-to-many, etc.)

Data Modeling Exercise Consider: What is the “entity”? What are the “attributes” of the entity?

Data Modeling Exercise What is the entity? What are the attributes?

Data Modeling Exercise What is the entity? What are the attributes?

Data Modeling Exercise What are the relationships? Grows In Apple Apple Tree Orchard Grows On

Data Modeling Exercise What are the relationships? Grows In Apple Apple Tree Orchard Grows On What about the business rules?

Assignment 2 Data Multiple Monitoring Sites 1 or More Time Series Per Sensor Multiple Sensors at Each Site

Assignment 2 Data

Assignment 2 A researcher recently deployed several instruments to continuously monitor streamflow and water quality at two sites in the Little Bear River, Cache Valley, Utah.  The instruments report measurements in numerous datalogger and metadata files that the researcher must now regularly retrieve, organize, quality-control/quality-check, aggregate, and manipulate before s/he can perform further analysis.   Design a data model to represent the data and its associated metadata Use MySQL Workbench to create an entity relationship diagram of your data model

Data Model Requirements What is the information/data domain that you are modeling? What are the 20 queries that you want to do? e.g., “Give me simultaneous observations of turbidity and TSS collected during the spring snowmelt period so I can develop a regression in R.” What software do you want (have) to use? How do you want to share the data?

Data Model Design Our focus – relational data model design Three stages: Conceptual data model Logical data model Physical data model

Conceptual Data Model (AKA – The Information Model) High-level description of the data domain Does not constrain how that description is mapped to an actual implementation in software There may be many mappings Relational database Object model XML schema, etc.

Apple/Tree/Orchard Conceptual Model Grows In Apple Apple Tree Orchard Grows On

Hydrologic Time Series An organization operates a network of monitoring sites. At each site they collect data for a number of time series, and each time series contains a time series of observations

Conceptual Data Model Entities Relationships Defines scope of the domain Defines and organizes data requirements Defines entities and relationships among them Entities Site 1 TimeSeries * Observations 1 Relationships *

Defining Entities and Relationships Instead of beginning with this: Sometimes its easier to write statements: Many TimeSeries are measured at a Site. Each TimeSeries contains one or more Observations. The nouns become entities and the verbs become relationships. Site TimeSeries 1 * 1 Observations *

Exercise: Conceptual Data Model

Logical Data Model Technology independent Contains more detail than the Conceptual Data Model Considered by many to be just an expanded conceptual data model Defines Entities AND their attributes Relationships AND cardinality Constraints (think Business Rules) Generally completed as a documented Entity Relationship (ER) Model or diagram

Example: ODM Logical Data Model ER Diagram

Entity Relationship Diagram Documentation of the structure of the data Used to communicate the design Serve as the basis for data model implementation

Entity Relationship Diagram (Relation Database Context) Entities effectively become tables Attributes describe entities and become fields (columns) in tables Relationships link tables on a common attribute or “key” and become formal constraints (part of the business rules)

Entities and Attributes What are the attributes of a monitoring site? Attributes Values Site Name: Little Bear River near Wellsville Site Code: USU-LBR-Wellsville Latitude: 41.643457 Longitude: -111.917649 Elevation: 1365 m State: Utah County: Cache Description: Attached to SR101 bridge. Site Type: Stream Relational Model: All instances of an entity have the same attributes Entity = Monitoring Site

ER Diagram Entity Notation Entity Name Data Type Attributes Entity

ER Diagram Relationship Notation Multiple notation systems are used Each software program is a little different Most common is “Crows Foot” Crows Foot Alternative 0 .. * 1 .. * 1 .. 1 0 .. 1

Relationship Cardinality and Participation Cardinality: maximum number of times an instance in one entity can be associated with instances in the related entity Participation: minimum number of times an instance in one entity can be associated with instances in the related entity

Cardinality Maximum number of times an instance of an entity can be associated with instances of a related entity Can ONLY have values of 1 or many Located closest to the entity in Crows Foot notation

Participation Minimum number of times an instance in one entity can be associated with instances in the related entity Indicates whether an instance of an entity MUST participate in the relationship Can ONLY have the values of 0 or 1

Mapping Cardinality and Participation Apple Grows_on AppleTree A1 A2 A3 A4 A5 A6 R1 R2 R3 R4 R5 R6 T1 T2 T3

Reading Cardinality and Participation

Relationship Examples Left to Right: A site has 0 or more time series of data. Right to Left: A time series is measured at 1 and only 1 site. Left to Right: A variable has 0 or more time series of data. Right to Left: A time series can have 1 and only 1 variable.

Relationship Examples Left to Right: A TimeSeries has 1 or more Observations. Right to Left: An Observation belongs to 1 and only 1 TimeSeries. Left to Right: An Observation has 0 or more Qualifiers. Right to Left: A Qualifier describes 0 or more Observations.

Primary and Foreign Keys Each row in a table should have an attribute that is a persistent, unique identifier – the “Primary Key” Primary key in “parent” table Foreign key in “child” table

Primary and Foreign Key Example OrchardID OwnerName Area_acres 1 John Appleseed 5.5 2 Daryl Appleseed 15 Orchards AppleTreeID Species Size DatePlanted OrchardID 1 Honeycrisp 5 4/15/2010 2 6 3 Apple Trees AppleID Color Weight AppleTreeID 1 Green 200 2 180 3 195 Apples

Primary and Foreign Keys Usually consist of integer values MUST be the same data type in parent and child tables

Creating an ER Diagram Using MySQL Workbench

Summary Data model design is a 3 step process – conceptual, logical, physical (future topic) Conceptual and logical data models can be expressed using Entity Relationship (ER) diagrams ER diagrams capture the entities, attributes, and relationships to model your information domain ER diagrams are a powerful way to document the design of your data model

Steps in Data Model Design Identify entities Identify relationships among entities Determine the cardinality and participation of relationships Designate keys / identifiers for entities List attributes of entities Identify constraints and business rules

Exercise Work alone or in groups of 2-3 Use MySQL Workbench to begin creating an Entity Relationship diagram Identify entities Specify attributes Create relationships

Assignment 2 Data Multiple Monitoring Sites 1 or More Time Series Per Sensor Multiple Sensors at Each Site