Relational Database.

Slides:



Advertisements
Similar presentations
Chapter 4: Logical Database Design and the Relational Model (Part I)
Advertisements

1 Logical Database Design and the Relational Model Modern Database Management.
Systems Development Life Cycle
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 4: Logical Database Design and the Relational Model
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
TM 6-1 Copyright © Addison Wesley Longman, Inc. & Dr. Chen, Business Database Systems Logical Database Design and the Relational Database Professor Chen.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: Logical Database Design and the Relational Model Modern Database Management 10.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Chapter 4: Logical Database Design and the Relational Model (Part II)
Web-Enabled Decision Support Systems
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Functional Dependence An attribute A is functionally dependent on attribute(s) B if: given a value b for B there is one and only one corresponding value.
Concepts and Terminology Introduction to Database.
Mapping from Data Model (ERD) to Relational Model
Chapter 5: Logical Database Design and the Relational Model
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
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.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
CS 370 Database Systems Lecture 9 The Relational model.
Chapter 5 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
© 2005 by Prentice Hall 1 The Database Development Process Dr. Emad M. Alsukhni The Database Development Process Dr. Emad M. Alsukhni Modern Database Management.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Pree Thiengburanathum, CAMT, Chiang Mai University 1 Database System Logical Database Design and the Relational Model November 1 st, 2009 Software Park,
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part c): Logical Database Design and the Relational Model Modern Database Management.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Normalization Hour1,2 Presented & Modified by Mahmoud Rafeek Alfarra.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: LOGICAL DATABASE.
Chapter 5 MODULE 6: Normalization © 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Prepared by: KIM GASTHIN M. CALIMQUIM.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 4, Part A: Logical Database Design and the Relational Model
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.
Chapter 4 © 2013 Pearson Education, Inc. Publishing as Prentice Hall Chapter 4: Logical Database Design and the Relational Model Modern Database Management.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 4: PART C LOGICAL.
Converting ER/EER to logical schema; physical design issues 1.
Logical Design & the Relational Model
Lecture 5 Supplement – ER Model & Mapping to Relational Model
Logical Database Design and the Rational Model
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 4: Part B Logical Database Design and the Relational Model
Normalization Karolina muszyńska
Chapter 5: Logical Database Design and the Relational Model
Lecture 2 The Relational Model
Example Question–Is this relation Well Structured? Student
Unit 4: Normalization of Relations
Translation of ER-diagram into Relational Schema
CMPE 226 Database Systems February 21 Class Meeting
Chapter 9 Designing Databases
Relational Model and ER Model: in a Nutshell
Chapter 5: Logical Database Design and the Relational Model
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Database Systems Instructor Name: Lecture-11.
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Presentation transcript:

Relational Database

Dr. Edgar F. (Ted) Codd To fellow pilots and aircrew in the Royal Air Force during World War II and the dons at Oxford: These people were the source of my determination to fight for what I believed was right during the ten or more years in which government, industry, and commerce were strongly opposed to the relational approach to database management.

Relational Definitions Every relation has a unique name. Every attribute value is atomic. Every row is unique. Attributes in tables have unique names. The order of the columns is irrelevant. The order of the rows is irrelevant.

Relational Definitions Tuple Attribute View

Relational Keys and Structures Primary Key Candidate Key Composite Key Foreign Key One-to-Many Relationship Many-to-Many Relationship Intersection Data

Relational Concepts Relational Algebra Relational Calculus Relational Operations SELECT PROJECT JOIN Equijoin - Join field appears twice. Natural Join - Join field appears once.

Schema for four relations (Pine Valley Furniture)

Instance of a relational schema

Integrity Constraints Domain Constraints Allowable values for an attribute. Entity Integrity No primary key attribute may be null. Operational Constraints Business rules.

Referential integrity constraints (Pine Valley Furniture)

Integrity Constraints Referential Integrity For example: Delete Rules Restrict Cascade Set-to-Null

Well-Structured Relations Insertion Anomaly Deletion Anomaly Modification Anomaly

Transforming E-R Diagrams into Relations 1. Map Regular Entities to Relations (Fig. 6-8). Composite attributes: Use only their simple, component attributes (Fig. 6-9). Multi-valued Attribute - Becomes a separate relation with a foreign key taken from the superior entity (Fig. 6-10).

Mapping a composite attribute (a) CUSTOMER entity type with composite attribute

(b) CUSTOMER relation with address detail

Transforming E-R Diagrams Into Relations 2. Map Weak Entities Becomes a separate relation with a foreign key taken from the superior entity (Fig. 6-11).

Example of mapping a weak entity (a) Weak entity DEPENDENT

(b) Relations resulting from weak entity

Transforming E-R Diagrams Into Relations 3. Map Binary Relationships One-to-Many - Primary key on the one side becomes a foreign key on the many side (Fig. 6-12). Many-to-Many - Create a new relation with the primary keys of the two entities as its primary key (Fig. 6-13). One-to-One - Primary key on the mandatory side becomes a foreign key on the optional side (Fig. 6-14).

Example of mapping a 1:M relationship (a) Relationship between customers and orders

(b) Mapping the relationship

Example of mapping an M:N relationship (a) Requests relationship (M:N)

(b) Three resulting relations

Mapping a binary 1:1 relationship

(b) Resulting relations

Transforming E-R Diagrams Into Relations 4. Map Associative Entities Identifier Not Assigned Default primary key for the association relation is the primary keys of the two entities (Fig. 6-15). Identifier Assigned It is natural and familiar to end-users. Default identifier may not be unique. (Fig. 6-16).

Mapping an associative entity with an identifier (a) Associative entity (SHIPMENT)

(b) Three relations

Transforming E-R Diagrams Into Relations 5. Map Unary Relationships One-to-Many - Recursive foreign key in the same relation (Fig. 6-17). Many-to-Many - Bill-of-materials: Two relations: One for the entity type. One for an associative relation in which the primary key has two attributes, both taken from the primary key of the entity. (Fig. 6-18).

Transforming E-R Diagrams Into Relations 6. Map Ternary (and n-ary) Relationships One relation for each entity and one for the associative entity. (Fig. 6-19).

Mapping a ternary relationship (a) Ternary relationship with associative entity

(b) Mapping the ternary relationship

Supertype/subtype relationships

Mapping Supertype/subtype relationships to relations

Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of data. The process of decomposing relations with anomalies to produce smaller, well-structured relations.

Functional Dependencies and Keys Functional Dependency: The value of one attribute (the determinant) determines the value of another attribute. Candidate Key: Each non-key field is functionally dependent on every candidate key. Fig. 6-22.

Steps in normalization

First Normal Form No multi-valued attributes. Every attribute value is atomic. Fig. 6-2a, b.

Second Normal Form 1NF and every non-key attribute is fully functionally dependent on the primary key. Every non-key attribute must be defined by the entire key, not by only part of the key. No partial functional dependencies. Fig. 6-2b, 6-22b.

Third Normal Form 2NF and no transitive dependencies (functional dependency between non-key attributes.) Fig. 6-23, 6-24, 6-25.

Relation with transitive dependency (a) SALES relation with simple data

(b) Transitive dependency in SALES relation

Removing a transitive dependency (a) Decomposing the SALES relation

(b) Relations in 3NF

Merging Relations (View Integration) Synonyms: Different names, same meaning. Homonyms: Same name, different meanings. Transitive Dependencies: e.g. (Stu ID, Major) (Stu ID, Advisor). Supertype/Subtype.