Logical Design & the Relational Model

Slides:



Advertisements
Similar presentations
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Advertisements

Monash University Week 7 Data Modelling Relational Database Theory IMS1907 Database Systems.
Systems Development Life Cycle
The Database Approach u Emphasizes the integration of data across the organization.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Normalization I.
Project and Data Management Software
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Week 6 Lecture Normalization
Lecture 12 Inst: Haya Sammaneh
Web-Enabled Decision Support Systems
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Object-Relational Modeling. What Is a Relational Data Model? Based on the concept of relations (tables of data) Relationships established by matching.
Unit 4 Object Relational Modeling. Key Concepts Object-Relational Modeling outcomes and process Relational data model Normalization Anomalies Functional.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 10 Normalization Pearson Education © 2009.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Logical Database Design and the Relational Model.
6-1 © Prentice Hall, 2007 Topic 6: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
8-1 © Prentice Hall, 2007 Chapter 8: Object-Relational Modeling Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Lecture 4: Logical Database Design and the Relational Model 1.
Logical Design 12/10/2009GAK1. Learning Objectives How to remove features from a local conceptual model that are not compatible with the relational model.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
Logical Database Design and Relational Data Model Muhammad Nasir
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
Chapter 8: Object-Relational Modeling
Logical Database Design and the Rational Model
Normalization.
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Normalization Karolina muszyńska
Part IV: Logical Database Design
Chapter 5: Logical Database Design and the Relational Model
MIS 322 – Enterprise Business Process Analysis
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.
Modern Systems Analysis and Design Third Edition
Example Question–Is this relation Well Structured? Student
Database Systems Instructor Name: Lecture-12.
Translation of ER-diagram into Relational Schema
CMPE 226 Database Systems February 21 Class Meeting
Chapter 9 Designing Databases
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Relational Database.
Database Normalization
Chapter 6 Normalization of Database Tables
Chapter 12 Designing Databases
Normalization Dale-Marie Wilson, Ph.D..
Chapter 10 Designing Databases
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Normalization.
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Normalisation to 3NF.
Database Design Hacettepe University
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Database Normalization.
Presentation transcript:

Logical Design & the Relational Model MGIS 641 Koç University

Learning objectives Define the terms: logical database model, relation, relational data model, well structured relation, anomaly, normalisation, functional dependency, determinant, composite key, partial functional dependency, transitive dependency, foreign key. Describe four steps in logical database design List properties of relations (re)Define two properties that are essential for a candidate key Give definitions for 1st, 2nd, 3rd normal forms Transform a relation in 1st normal form into 2nd , 3rd normal form Transform an E-R diagram to logically equivalent relations

Introduction Logical database design is a process of transforming the conceptual data model into a logical database model. There are four major logical database models in use : relational most common hierarchical, network, relational, object-oriented

DB development process Planning Enterprise data model Analysis Conceptual data model Logical DB design Logical data model Physical DB design Technology model Implementation DB & repositories

Database Design Logical Database model : A design that conforms to the data model for a class of DBMSs. Hierarchical Model :A data model in which records are arranged in a top-down structure that resembles a tree

Hierarchical DB Model The hierarchical data model is set up like a "forest" or collection of tree structures. advantage: speed and efficiency for certain kinds of applications. The hierarchical data model is a good choice when the data to be modeled is also like a tree. problem: how data is accessed is predefined; and each relationship must be explicitly defined when the database is created The hierarchical data model is a special case of the network data model. The best-known hierarchical database management system is IBM's IMS. It was originally a purely hierarchical system but has gained some non-hierarchical features as a result of practical needs.

Network DB Model Network Database Model :A data model in which each record type may be associated with an arbitrary number of different records

Network DB Model An example of a network database management system is IDMS. creates relationship among data through a linked-list structure in which subordinate records (members) can be linked to more than one data element (owner). A single data element may be a part of many relationships. pointer - explicit link, storage addresses that contain the location of a related record complexity: for every set of linked data elements, a pair of pointers must be maintained. It is difficult to conceptualize complex data structures using this model. speed: direct links make systems implemented using the network model very fast

Object-Oriented DB Model : A DB model in which data attributes and methods that operate on those attributes are encapsulated in structures called objects. Relational DB Model : A data model that represents data in the form of tables

Relational Data Model Relational DB Model : A data model that represents data in in the form of tables and relations. Relation : A named, two-dimensional table of data. each relation consists of a set of named columns and an arbitrary number of rows. The relational Data Model consists of three components : Data Structure : data are organised in the form of tables. Data manipulation : SQL operations+ Data integrity : facilities are included to specify business rules that maintain the integrity of data when they are manipulated.

Overview of Logical DB Design Conceptual Data Model Represent Entities : Each Entity Type -> Relation; Identifier -> Primary Key, Attributes -> Non-key attributes Represent Relationships: Depends on the nature of the relationship. Foreign key, New relation etc. Normalise Relations : Unnecessary duplications & anomalies are removed. Merge Relations : Redundant entities are removed. Represent Entities Represent Relationships Normalise Relations Merge Relations Logical Data Model

Relations Relation EMPLOYEE Short Hand for the structure of EMPLOYEE relation : EMPLOYEE (EMP NO, NAME, PHONE, SALARY)

Properties of Relations Not all tables are relations. Entries in Columns are Atomic : An entry in a cell is atomic (single-valued). No repeating groups or multivalued attributes allowed. Entries in Columns are from the same Domain Each row is unique The sequence of columns is Insignificant The Sequence of rows is Insignificant

Properties of relations Multi -> Single valued cells

Well Structured Relations Well Structured Relation : A relation that contains a minimum amount of redundancy and allows users to insert, modify and delete rows in a table without errors and inconsistencies. Anomalies : errors or inconsistencies that may result when a user tries to update a table that contains redundant data. Insertion anomaly (Student table try to add a student) Deletion anomaly (Delete E30 student) Modification anomaly (Modify E10 student DEPT.)

Concepts of Normalisation Normalisation : The process of converting complex data structures into simple, stable data structures. Normal form : A state of a relation that can be determined by simple rules regarding dependencies to that relation. Table with repeating groups Remove repeating groups First Normal Form Remove partial dependencies Second Normal Form Remove transitive dependencies Third Normal Form Remove remaining anomalies Boyce-Codd Normal Form Remove multivalued dependencies Fourth Normal Form Remove remaining anomalies Fifth Normal Form

Functional dependence and Keys Functional Dependency : A particular relationship between two attributes. For any relation R, attribute B is functionally dependent on attribute A if, for every valid instance of A, that value of A uniquely determines the value of B. The functional dependence of B on A is represented as A --> B e.g. SSN -> NAME, ADDRESS ISBN -> TITLE, AUTHOR Determinant : The attribute on the left hand side of the arrow in a functional dependency. e.g. SSN, ISBN A -> B ?

Rules of Functional Dependency X -> X Reflexive rule If X -> Y Then XZ -> Y augmentation rule If X -> Y and X -> Z then X -> YZ union rule If X -> Y then X -> Z where Z is a subset of Y decomposition rule If X -> Y and Y -> Z then X -> Z transitivity rule If X -> Y and YZ -> W then XZ -> W pseudotransitivity rule. Properties of candidate keys Unique Identification : For every row, the value of the key must uniquely identify that row. Key attribute -> Non- key attribute Non-redundancy : No attribute in the key can be deleted without destroying the property of unique identification. Composite Key : A primary key that contains more than one attribute.

Basic Normal Forms First Normal Form : A relation that contains no repeating groups. K.U. GRADE REPORT Name : Ahmet ID :S10 Major : ENG COURSE TITLE INST INST ROOM GRADE MGIS401 Databases OAY B110 A OPSM402 Operations BT B109 B 1NF Grade Report Relation

Basic Normal Forms Second Normal Form : A relation is in 2nd Normal Form if it is in 1st Normal Form and every nonkey attribute is full functionally-dependent on the primary key. Thus no non-key attribute is functionally dependent on part (but not all) of the primary key. Analyse the functional dependencies : STD ID -> NAME, MAJOR COURSE -> COURSE TITLE, INST. NAME, INST. ROOM STUDENT ID, COURSE -> GRADE INST. NAME -> INST. ROOM GRADE REPORT (STD ID, NAME, MAJOR, COURSE, COURSE TITLE, INST. NAME, INST. ROOM, GRADE) 1NF Grade Report Relation

Basic Normal Forms Identify the partial dependencies : STD ID -> NAME, MAJOR COURSE -> COURSE TITLE, INST. NAME, INST. ROOM STUDENT ID, COURSE ID -> GRADE Remove partial dependencies : Create three new relations STUDENT (STD ID, NAME, MAJOR) COURSE (COURSE, COURSE TITLE, INST. NAME, INST. ROOM) REGISTRATION(STD ID, COURSE, GRADE) 1NF Grade Report Relation 2NF 2NF 2NF

Basic Normal Forms Anomalies in 2nd normal form exist. Modification anomaly e.g. change Room of Inst. OAY Deletion Anomaly : Delete OPSM402 Row loose info about BT. Anomalies due to Entity type INSTRUCTOR. (not designed in yet) Analyse the functional dependencies : COURSE -> COURSE TITLE, INST. NAME, INST. ROOM INST. NAME -> INST. ROOM Transitive Dependency Third Normal Form : A relation is in 3nd Normal Form if it is in 2nd Normal Form and no transitive dependencies exist. Transitive dependency : A functional dependency between two (or more) non-key attributes in a relation. 3rd Normal Form 2nd Normal Form 3rd Normal Form

Transforming E-R Diagrams to Relations Represent Entities : Primary Key of the entity type --> Primary Key of the Relation Check if a) The value of the key uniquely identifies every row in the relation b) The key should be non-redundant; that is no attribute in the key can be deleted without destroying the unique identification. Each non-key attribute --> non-key attribute of the relation. e.g. CUSTOMER (CUSTOMER NO, NAME, ADDRESS, DISCOUNT) CUSTOMER NO NAME ADDRESS DISCOUNT CUSTOMER E-R Diagram Corresponding Relation

Transforming E-R Diagrams to Relations Represent Relationships :1:N relationship CUSTOMER NO NAME ADDRESS DISCOUNT CUSTOMER Places ORDER NO DATE PROM. DATE ORDER foreign key E-R Diagram Corresponding Relations

Transforming E-R Diagrams to Relations Represent Relationships :M:N relationship DESCP. PRODUCT NO PRODUCT QUANTITY Places Requests ORDER NO DATE PROM. DATE ORDER E-R Diagram Corresponding Relations

Transforming E-R Diagrams to Relations Represent Relationships :Unary relationships 1:N ADDRESS NAME EMP. NO EMPLOYEE manages EMPLOYEE (EMP. NO, NAME, ADDRESS, MANAGER ID) NAME M:N ITEM NO ITEM Contains QUANTITY ITEM(ITEM NO, NAME) ITEM BILL (ITEM NO, COMPONENT NO, QUANTITY)

Transforming E-R Diagrams to Relations Represent Relationships :ISA Relationship ADDRESS RENT PROPERTY ID PROPERTY ISA ISA BEACH PROPERTY MOUNTAIN PROPERTY PROPERTY ID BLOCKS TO BEACH PROPERTY ID SKIING PROPERTY(PROPERTY NO, RENT, ADDRESS) BEACH PROPERTY(PROPERTY NO, BLOCKS TO BEACH) MOUNTAIN PROPERTY(PROPERTY NO, SKIING)

Merging relations - View Integration E-R Diagrams are transformed then checked for 3rd Normal Form. Normalised relations may have been created from several E-R diagrams, some relations may be redundant. Merge relations to remove redundancies. Examples : EMPLOYEE1(EMPLOYEE NO, NAME, ADDRESS) EMPLOYEE2(EMPLOYEE NO, NAME, JOBCODE) merged to EMPLOYEE (EMPLOYEE NO, NAME, ADDRESS, JOBCODE) Some View Integration Problems are due to synonyms, homonyms, transitive dependencies, class/subclass relations

View Integration Problems Synonyms e.g. STUDENT1 (STUDENT ID, NAME) STUDENT2 (REGISTRATION NO, NAME, ADDRESS) Merge STUDENT (ID NO, NAME, ADDRESS) Homonyms e.g. STUDENT1 (STUDENT ID, NAME, ADDRESS) STUDENT2 (STUDENT ID, NAME, ADDRESS) STUDENT (STUDENT ID, NAME, HOME ADDRESS, CAMPUS ADDRESS)

View Integration Problems Transitive dependencies e.g. STUDENT1 (STUDENT ID, MAJOR) STUDENT2 (STUDENT ID, ADVISOR) IF MAJOR -> ADVISOR TRANSITIVE DEPENDENCY if directly merged. STUDENT (STUDENT ID , MAJOR) MAJOR ADVISOR(MAJOR, ADVISOR ) ISA e.g. PATIENT1 (PATIENT ID, NAME, ADDRESS) PATIENT2 (PATIENT ID ,ROOM NO) there are two type of patients in and outpatients therefore no direct merge PATIENT (PATIENT ID, NAME, ADDRESS) INPATIENT (PATIENT ID, ROOM NO) OUTPATIENT (PATIENT ID, DATE TREATED)