Database Design Process. Databases - Entity-Relationship Modelling. Requirements Analysis. Database Design



Similar documents
Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Data Modelling and E-R Diagrams

The Entity-Relationship Model

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

Databases What the Specification Says

Overview. Physical Database Design. Modern Database Management McFadden/Hoffer Chapter 7. Database Management Systems Ramakrishnan Chapter 16

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

Database Systems. Lecture 1: Introduction

Concepts of Database Management Seventh Edition. Chapter 6 Database Design 2: Design Method

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

Foundations of Information Management

TIM 50 - Business Information Systems

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Data Modeling. Database Systems: The Complete Book Ch ,

Conceptual Design Using the Entity-Relationship (ER) Model

Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length

A brief overview of developing a conceptual data model as the first step in creating a relational database.

Rose Data Modeler (logical)

Review Entity-Relationship Diagrams and the Relational Model. Data Models. Review. Why Study the Relational Model? Steps in Database Design

Entity-Relationship Model

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Foundations of Information Management

Introduction to Database Systems CS4320/CS5320. CS4320/4321: Introduction to Database Systems. CS4320/4321: Introduction to Database Systems

Fundamentals of Database Design

Using Use Cases for requirements capture. Pete McBreen McBreen.Consulting

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

2. Conceptual Modeling using the Entity-Relationship Model

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Lecture 12: Entity Relationship Modelling

The Entity-Relationship Model

The Entity-Relationship Model

ER modelling, Weak Entities, Class Hierarchies, Aggregation

Lecture Notes INFORMATION RESOURCES

DATABASE MANAGEMENT SYSTEMS. Question Bank:

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Lecture 6. SQL, Logical DB Design

Databasesystemer, forår 2005 IT Universitetet i København. Forelæsning 3: Business rules, constraints & triggers. 3. marts 2005

The Relational Data Model: Structure

COURSE NAME: Database Management. TOPIC: Database Design LECTURE 3. The Database System Life Cycle (DBLC) The database life cycle contains six phases;

Lesson 8: Introduction to Databases E-R Data Modeling

Database Design. Goal: specification of database schema Methodology: E-R Model is viewed as a set of

XV. The Entity-Relationship Model

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

5.5 Copyright 2011 Pearson Education, Inc. publishing as Prentice Hall. Figure 5-2

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Demystified CONTENTS Acknowledgments xvii Introduction xix CHAPTER 1 Database Fundamentals CHAPTER 2 Exploring Relational Database Components

æ A collection of interrelated and persistent data èusually referred to as the database èdbèè.

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

Foundations of Business Intelligence: Databases and Information Management

AVOIDANCE OF CYCLICAL REFERENCE OF FOREIGN KEYS IN DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL

CPS352 Database Systems: Design Project

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

CHAPTER 1: INTRODUCTION TO RAPID APPLICATION DEVELOPMENT (RAD)

Data Modeling: Part 1. Entity Relationship (ER) Model

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Course Title: Database Design I

Database Design Process

SQL Simple Queries. Chapter 3.1 V3.0. Napier University Dr Gordon Russell

Entity Relationship Diagram

Course: CSC 222 Database Design and Management I (3 credits Compulsory)

THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE TECHNOLOGY AND ENVIRONMENTAL STUDIES BACHELOR OF SIENCE IN INFORMATION AND COMMUNICATION TECHNOLOGY

Databases and BigData

Exercise 1: Relational Model

How To Write A Diagram

DATABASE INTRODUCTION

Basics of Dimensional Modeling

THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE TECHNOLOGY AND ENVIRONMENTAL STUDIES BACHELOR OF SIENCE IN DATA MANAGEMENT

Data Analysis 1. SET08104 Database Systems. Napier University

n Assignment 4 n Due Thursday 2/19 n Business paper draft n Due Tuesday 2/24 n Database Assignment 2 posted n Due Thursday 2/26

Chapter 2: Designing XML DTDs

Once the schema has been designed, it can be implemented in the RDBMS.

Database Management Systems

Fundamentals of Database System

Conceptual Design: Entity Relationship Models. Objectives. Overview

Chapter 2. Data Model. Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel

ETL Process in Data Warehouse. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT


LOGICAL DATABASE DESIGN

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1

3. Relational Model and Relational Algebra

DATA MODELING AND RELATIONAL DATABASE DESIGN IN ARCHAEOLOGY

1 Review of Least Squares Solutions to Overdetermined Systems

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization


Course MIS. Foundations of Business Intelligence

CSC 443 Data Base Management Systems. Basic SQL

Chapter 6 FOUNDATIONS OF BUSINESS INTELLIGENCE: DATABASES AND INFORMATION MANAGEMENT Learning Objectives

Foundations of Business Intelligence: Databases and Information Management

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Transcription:

Process Databases - Entity-Relationship Modelling Ramakrishnan & Gehrke identify six main steps in designing a database Requirements Analysis Conceptual Design Logical Design Schema Refinement Physical Design Application & Security Design (GF Royle 2006-8, N Spadaccini 2008) 1 / 24 (GF Royle 2006-8, N Spadaccini 2008) 2 / 24 Requirements Analysis ER-Modelling Requirements Analysis Conceptual Design Logical Design Schema Refinement Physical Design Application/Security Design Requirements Analysis is the process of determining what the database is to be used for. It involves interviews with user groups and other stakeholders to identify what functionality they require from the database, what kinds of data they wish to process and the most frequently performed operations. This discussion is at a non-technical level and enables the database designers to understand the business logic behind the desired database. (GF Royle 2006-8, N Spadaccini 2008) 3 / 24 (GF Royle 2006-8, N Spadaccini 2008) 4 / 24

Conceptual & Logical Design After the modelling Using the ER data model, the conceptual design stage involves identifying the relevant entities and the relationships between them and producing an entity-relationship diagram. The logical design stage involves translating the ER diagram into actual relational database schema. Once a suitable ER model has been constructed, then this can be translated into a relational database fairly easily. However ER modelling is as much an art as a science, as there are usually many choices to be made and the consequences of each choice sometimes does not become apparent until problems arise later. We will cover the remaining steps of the process later as they involve the effective use of the database after it s fundamental structure has been determined. This involves Mathematical analysis and refinement of the schema Performance-based decisions on indexing, machine capacities, required performance etc. Interfacing with client applications and security (GF Royle 2006-8, N Spadaccini 2008) 5 / 24 (GF Royle 2006-8, N Spadaccini 2008) 6 / 24 Iterative Process Running Example As with all software engineering processes, information uncovered during later phases of the project may alter some design decisions so the nice neat diagram of the 6 phases is really an iterative process where each stage feeds back to the previous stages. One of the major causes of design alterations is incomplete requirements analysis this is frequently attributed to users not being aware of the possibilities until they start using the system, or at least a prototype. We use a modified version of Exercise 2.3 in the text as an example. This question asks the user to produce an ER model from the following requirements: A lecturer has a staff number, a and a rank Research projects have a project id, a sponsoring organization and a budget Each project has one lecturer as a principal investigator Each project may have other lecturers as co-investigators Each lecturer can be principal or co-investigator on multiple projects (GF Royle 2006-8, N Spadaccini 2008) 7 / 24 (GF Royle 2006-8, N Spadaccini 2008) 8 / 24

Entity Sets Example key We have already introduced the concept of an entity-set and explained how that can be diagrammed and then translated directly into a relational database. One detail that we omitted is that a relation should be a set and therefore cannot contain any duplicates elements the corresponding database table should not have any duplicate rows. A key for an entity set is an attributed, or combination of attributes that is guaranteed to distinguish the elements. A Student is always uniquely identified by their student-id so this attribute is a suitable key for this relation. student-id Students In an ER diagram, an entity set s key is designated by underlining the attribute or attributes that form the key. (GF Royle 2006-8, N Spadaccini 2008) 9 / 24 (GF Royle 2006-8, N Spadaccini 2008) 10 / 24 Why are keys important? Example Entity It is important to identify the key for an entity set and indeed as we will see later for any relation in a database for several reasons: Explicitly identify a key ensures that the data model is logically consistent. When implemented, the DBMS can enforce key constraints that ensure that the nominated key does indeed uniquely identify each row. The DBMS can index the table using the key values and manipulate that relation very efficiently. The DBMS can enforce referential integrity by ensuring that tables that refer to other tables remain in a consistent state this comes later! Modelling of the entities in the example is fairly easy: staff-id rank So the actual entities would be things like staff-id rank 00144238 J Smith" Associate Professor" (GF Royle 2006-8, N Spadaccini 2008) 11 / 24 (GF Royle 2006-8, N Spadaccini 2008) 12 / 24

Example Entity Hmmm, what about the key proj-id sponsor budget Although it is unlikely that two sponsoring organizations use the same format for project id numbers, it is possible. So maybe the key should consist of the two attributes (proj-id, sponsor)? proj-id sponsor budget So the actual entities would be things like prof-id sponsor budget DH10304 ARC $120000 In this case, the attributes that form the key are all underlined. (GF Royle 2006-8, N Spadaccini 2008) 13 / 24 (GF Royle 2006-8, N Spadaccini 2008) 14 / 24 Relationship Sets Diagramming Relationships The power of relational databases comes from the ability to model and query relationships between entity sets. If E 1, E 2,..., E n are entity sets, then a relationship set is a subset A relationship is diagrammed by a d diamond shape that is connected by lines to the related entity sets. staff-id rank proj-id sponsor budget R E 1 E 2 E n In other words R is an n-ary relation whose elements are entities. As entity sets are also relations, this means that we are using relations/tables to model both entity sets and relationship sets! Here we are modelling the relationship which relates projects to their principal investigators. (GF Royle 2006-8, N Spadaccini 2008) 15 / 24 (GF Royle 2006-8, N Spadaccini 2008) 16 / 24

Elements of the relationship set A sample relationship set The actual elements of the relationship set are the pairs that specify which lecturer manages which project. Thus if Associate Professor Smith manages the project DH10304 then that pair of entities would be an element of the relationship set. Notice that we can unambiguously specify this pair just by storing the keys for this pair: 23818331 10374819 00144238 23901910 NSF3383 UW0012 DH10304 (00144238, DH10304) This of course is exactly how an RDBMS stores a relationship set. Each black circle represents one element of the relation. (GF Royle 2006-8, N Spadaccini 2008) 17 / 24 (GF Royle 2006-8, N Spadaccini 2008) 18 / 24 Participation Constraints Participation Constraints 23818331 10374819 NSF3383 UW0012 If the participation is a constraint based on the business logic (rather than just an accident of this particular set of data), then it can be encoded into the ER diagram (and subsequently enforced by the DBMS). 00144238 23901910 DH10304 Every project must have a principal investigator and so there is total participation of the entity set s in the relationship set. Partial participation One-to-Many Total participation This is indicated in the ER diagram by a thick black line connecting the entity set with the relationship set. (GF Royle 2006-8, N Spadaccini 2008) 19 / 24 (GF Royle 2006-8, N Spadaccini 2008) 20 / 24

ER diagram with participation constraints Key constraints staff-id rank proj-id sponsor budget The relationship is one-to-many because each project has just one principal investigator. This is called a key constraint because it means that in any allowable instance of each entity from appears at most once. In particular, this means that the key for can be used as a key for. This is indicated in the ER diagram by an arrow-head on the line connecting the entity set with the relationship set. (GF Royle 2006-8, N Spadaccini 2008) 21 / 24 (GF Royle 2006-8, N Spadaccini 2008) 22 / 24 ER diagram with participation and key constraints Other conventions staff-id rank proj-id sponsor budget There are lots of other conventions for ER diagrams that include other symbols, or possibly little numbers indicating the exact form of the relationship etc., thus making it more detailed and more expressive. We deliberately use this very simple form of ER diagramming because the constraints that are used in this model can all be implemented in standard SQL, and thus the database model corresponds precisely to the ER diagram. (GF Royle 2006-8, N Spadaccini 2008) 23 / 24 (GF Royle 2006-8, N Spadaccini 2008) 24 / 24