Relational Database Concepts



Similar documents
Introduction to SQL and database objects

Relational Database Basics Review

Fundamentals of Database Design

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

Lesson 8: Introduction to Databases E-R Data Modeling

Data Modeling Basics

DATABASE MANAGEMENT SYSTEMS. Question Bank:

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

The Relational Data Model: Structure

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

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

Data Modelling and E-R Diagrams

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

The Relational Model. Why Study the Relational Model?

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

SCHEMAS AND STATE OF THE DATABASE

1. INTRODUCTION TO RDBMS

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

The Entity-Relationship Model

EECS 647: Introduction to Database Systems

Doing database design with MySQL

CSE 132A. Database Systems Principles

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

Database Design Methodology

Lecture 6. SQL, Logical DB Design

AS LEVEL Computer Application Databases

BCA. Database Management System

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

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?

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

ISM 318: Database Systems. Objectives. Database. Dr. Hamid R. Nemati

SQL AND DATA. What is SQL? SQL (pronounced sequel) is an acronym for Structured Query Language, CHAPTER OBJECTIVES

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

7. Databases and Database Management Systems

An Example: Video Rental System

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

Database Fundamentals

Databases and DBMS. What is a Database?

Information Systems Analysis and Design CSC John Mylopoulos Database Design Information Systems Analysis and Design CSC340

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

History of Database Systems

Chapter 2: Entity-Relationship Model. E-R R Diagrams

Relational Databases. Christopher Simpkins

Conceptual Design Using the Entity-Relationship (ER) Model

Chapter 1: Introduction

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

Study Notes for DB Design and Management Exam 1 (Chapters 1-2-3) record A collection of related (logically connected) fields.

Entity-Relationship Model

2. Conceptual Modeling using the Entity-Relationship Model

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Foundations of Information Management

Entity Relationship Diagram

1 Class Diagrams and Entity Relationship Diagrams (ERD)

1 File Processing Systems

Databases What the Specification Says

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

IINF 202 Introduction to Data and Databases (Spring 2012)

Designing a Database Schema

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database.

Database Design and Programming

Tutorial on Relational Database Design

Physical Database Design Process. Physical Database Design Process. Major Inputs to Physical Database. Components of Physical Database Design

DATABASE REVERSE ENGINEERING

Foundations of Business Intelligence: Databases and Information Management

Designing Databases. Introduction

Data Modeling. Database Systems: The Complete Book Ch ,

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

Database Design. Adrienne Watt. Port Moody

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

Logical Schema Design: The Relational Data Model

Ken Goldberg Database Lab Notes. There are three types of relationships: One-to-One (1:1) One-to-Many (1:N) Many-to-Many (M:N).

Introduction to normalization. Introduction to normalization

How To Write A Diagram

Module 4 Creation and Management of Databases Using CDS/ISIS

Databases and BigData

ECS 165A: Introduction to Database Systems

A Short Tutorial on Using Visio 2010 for Entity-Relationship Diagrams

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

Lecture Notes INFORMATION RESOURCES

David M. Kroenke and David J. Auer Database Processing 11 th Edition Fundamentals, Design, and Implementation. Chapter Objectives

RELATIONAL DATABASE DESIGN

IT2304: Database Systems 1 (DBS 1)

Introduction to Databases

7.1 The Information system

DB2 backup and recovery

IT2305 Database Systems I (Compulsory)

Database Design Process

Foundations of Business Intelligence: Databases and Information Management

Database Fundamentals: 1

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

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 7

Foundations of Information Management

Fundamental Concepts of Relational Theory Technical Brief

CSE 233. Database System Overview

Transcription:

Relational Database Concepts IBM Information Management Cloud Computing Center of Competence IBM Canada Labs 1 2011 IBM Corporation

Agenda Overview Information and Data Models The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 2 2011 IBM Corporation

Supporting reading material & videos Reading materials Database Fundamentals ebook Chapter 1: Databases and information models Chapter 2: The relational data model Chapter 3: The conceptual data model (optional) Chapter 4: Relational database design (optional) Videos db2university.com course AA001EN Lesson 1: Relational database concepts 3 2011 IBM Corporation

Agenda Overview Information and Data Models The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 4 2011 IBM Corporation

Data vs. Information Data: Collection of letters, numbers or facts Information: Processed data that provides value 5 2011 IBM Corporation

Databases and DBMS Databases A repository of data DBMS (Database management system) Software system that manages databases The terms Database, DBMS, data server, database server often used interchangeably to refer to a DBMS Why a DBMS? Security Can handle many users with good performance Allows for concurrency while keeping data consistent Protects from disaster 6 2011 IBM Corporation

Agenda Overview Information and Data Models The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 7 2011 IBM Corporation

Information and Data Models Relationship between an Information Model and a Data Model 8 2011 IBM Corporation

Data Models Network Hierarchical Relational Entity-Relationship Semantic Object-oriented Object-relational Semi-structured Extended relational 9 2011 IBM Corporation

Agenda Overview Information and Data Models The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 10 2011 IBM Corporation

Relational Model 11 2011 IBM Corporation

Entity-Relationship Diagrams Building Blocks Entities Entity Attributes Attribute 12 2011 IBM Corporation

Entity and Attributes 13 2011 IBM Corporation

ER diagram Description Title Editon Aisle Book Year Pages ISBN Price 14 2011 IBM Corporation

Exercise: Identify entities and attributes House Phone # Social Security Number Computer Date Product Height Order # 15 2011 IBM Corporation

Did you get them right? House Phone # Social Security Number Computer Date Product Height Order # 16 2011 IBM Corporation

Agenda Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 17 2011 IBM Corporation

Relationships Building Blocks Entity sets Relationship sets Crows Foot notations 18 2011 IBM Corporation

ERD of Book Description Title Editon Aisle Book Year Pages ISBN Price 19 2011 IBM Corporation

ERD of Author Author_Id Lastname Country Author Firstname City Email 20 2011 IBM Corporation

Example 1 21 2011 IBM Corporation

Example 2 22 2011 IBM Corporation

Types of Relationships Book Authored By Author One-to-one Relationship 23 2011 IBM Corporation

Types of Relationships (Continued) Book Authored By Author One-to-many Relationships 24 2011 IBM Corporation

Types of Relationships (Continued) Book Authored By Author Many-to-many Relationships 25 2011 IBM Corporation

Agenda Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 26 2011 IBM Corporation

ERD revisited Description Title Editon Aisle Book Year Pages ISBN Price 27 2011 IBM Corporation

Mapping entity to a table Entity Description Title Editon Book Aisle Attributes Year Table Pages ISBN Price Columns 28 2011 IBM Corporation

Mapping entity to a table (Continued) Table: Book Title Edition Year Price ISBN Pages Aisle Description Database Fundamentals 1 2010 24.99 978-0- 98662 83-1-1 300 DB- A02 Teaches you the fundamentals of databases Getting started with DB2 Express-C 1 2010 24.99 978-0- 98662 83-5-1 280 DB- A01 Teaches you the essentials of DB2 using DB2 Express- C, the free version of DB2 29 2011 IBM Corporation

Mapping entity to a table (Continued) Table: Author Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilva nia RO 30 2011 IBM Corporation

Agenda Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 31 2011 IBM Corporation

Relational Model Concepts Dr. E.F. Codd of IBM in 1970: A Relational Model for Large Shared Data Banks Building Blocks Relation Sets 32 2011 IBM Corporation

A Relational Database Relational Database Relation Relation Schema Relation Instance 33 2011 IBM Corporation

A Relation AUTHOR(Author_ID: char, lastname: varchar, firstname: varchar, email: varchar, city: varchar, country: char) Relation Instance ATTRIBUTES Relation Schema DEGREE=6 CARDINALITY=5 Author_ ID Lastname Firstna me Email City Country A1 Chong Raul rfc@ibm.com Toronto CA TUPLES A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO A DOMAIN is the set of all possible values for a specific attribute 34 2011 IBM Corporation

Agenda Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 35 2011 IBM Corporation

Relational Model Constraints Business Rules Book Authored By Author Referencing Data Integrity 36 2011 IBM Corporation

ERD representation of a Relational Data Model Primary Key Parent Table Dependant Table Foreign Key 37 2011 IBM Corporation

Constraints Entity Integrity Constraint Referential Integrity Constraint Semantic Integrity Constraint Domain Constraint Null Constraint Check Constraint 38 2011 IBM Corporation

Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 39 2011 IBM Corporation

Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 40 2011 IBM Corporation

Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 NULL Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 41 2011 IBM Corporation

Entity Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 NULL Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 NULL Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 42 2011 IBM Corporation

Referential Integrity Constraint Book Authored By Author Referencing 43 2011 IBM Corporation

Semantic Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 44 2011 IBM Corporation

Semantic Integrity Constraint AUTHOR Author_ID [PK] Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA 12(*)&^23 A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 45 2011 IBM Corporation

Domain Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 46 2011 IBM Corporation

Domain Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 34 34 34 47 2011 IBM Corporation

NULL Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 48 2011 IBM Corporation

NULL Constraint AUTHOR Author_ID Lastname Firstname Email City Country A1 Chong Raul rfc@ibm.com Toronto CA NULL A2 Ahuja Rav ra@ibm.com Toronto CA A3 Hakes Ian ih@ibm.com Toronto CA NULL A4 Sharma Neeraj ns@ibm.com Chennai IN A5 Perniu Liviu lp@univ.com Transilvania RO 49 2011 IBM Corporation

Check Constraint BOOK Title Edition Year Price ISBN Pages Aisle Description Database Fundamentals 1 2010 24.99 978-0- 98662 83-1-1 300 DB- A02 Teaches you the fundamentals of databases Getting started with DB2 Express-C 1 2010 24.99 978-0- 98662 83-5-1 280 DB- A01 Teaches you the essentials of DB2 using DB2 Express- C, the free version of DB2 50 2011 IBM Corporation

Check Constraint BOOK Title Edition Year Price ISBN Pages Aisle Description Database Fundamentals 1 2010 24.99 978-0- 98662 83-1-1 300 DB- A02 Teaches you the fundamentals of databases Getting started with DB2 Express-C 1 2010 2015 24.99 978-0- 98662 83-5-1 280 DB- A01 Teaches you the essentials of DB2 using DB2 Express- C, the free version of DB2 51 2011 IBM Corporation

Agenda Overview Entity-relationship diagrams The relational model Entity-Relationship diagrams Types of relationships Mapping entities to tables Relational model concepts Relational model constraints Normalization 52 2011 IBM Corporation

Normalization Process in database design to remove redundancies Example: Consider the following table listing all the tasks of an employee: Problem: If John moves to a new city, all entries related to John must be updated 53 2011 IBM Corporation

Normalization (continued) No redundancy, no anomalies, no loss of information 54 2011 IBM Corporation

Thank you! 55 2011 IBM Corporation