Copyright, Harris Corporation & Ophir Frieder, 19981 Relational Definitions.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Advertisements

The Relational Model Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Chapter 3 : Relational Model
Chapter 11 Functional Dependencies. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.11-2 Topics in this Chapter Basic Definitions Trivial.
Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Relations The Relational Data Model John Sieg, UMass Lowell.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
DATABASE DESIGN Functional Dependencies. Overview n Functional Dependencies n Normalization –Functional dependencies –Normal forms.
Functional Dependency Rajhdeep Jandir. Definition A functional dependency is defined as a constraint between two sets of attributes in a relation from.
Normalization I.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
1 Pertemuan 04 MODEL RELASIONAL Matakuliah: >/ > Tahun: > Versi: >
Thomas Connolly and Carolyn Begg’s
Database Architecture The Relational Database Model.
Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11.
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 4 The Relational Model Pearson Education © 2014.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Chapter 4 The Relational Model.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
Content Resource- Elamsari and Navathe, Fundamentals of Database Management systems.
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Copyright, Harris Corporation & Ophir Frieder, Normal Forms “Why be normal?” - Author unknown Normal.
CG084&085 / / 1 The Relational Data Model Properties of Relations Keys and Constraints.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Chapter 3 The Relational Model. 2 Chapter 3 - Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – Relational Model.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
The Relational Model Pertemuan 03 Matakuliah: M0564 /Pengantar Sistem Basis Data Tahun : 2008.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Logical Database Design (1 of 3) John Ortiz Lecture 6Logical Database Design (1)2 Introduction  The logical design is a process of refining DB schema.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
CMU SCS Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications C. Faloutsos – A. Pavlo Lecture#16: Schema Refinement & Normalization.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Databases Illuminated Chapter 3 The Entity Relationship Model.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
N-ary Relations & Their Applications. 2 n-ary Relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 x A 2 x … x A.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Databases 1 Sixth lecture. 2 Functional Dependencies X -> A is an assertion about a relation R that whenever two tuples of R agree on all the attributes.
Relational Database Design Algorithms and Further Dependencies.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Chapter 4 The Relational Model Pearson Education © 2009.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Functional Dependency
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Data Base System Lecture 6: Relational Model
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
The Relational Model Transparencies
Functional Dependencies
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Presentation transcript:

Copyright, Harris Corporation & Ophir Frieder, Relational Definitions

Copyright, Harris Corporation & Ophir Frieder, Objectives To define basic relation terms including entity, attribute, domain, relation, relational scheme, and functional dependency.

Copyright, Harris Corporation & Ophir Frieder, Relational Terminology A domain is a set of scalar values, all of the same type. Examples: US city names- {San Diego, Miami, etc} The names of US States- {Texas, New York, etc} City populations- {1,2,3,...} (positive integers)

Copyright, Harris Corporation & Ophir Frieder, Relational Terminology, Cont. A relation is a subset of the Cartesian product of one or more domains. Example: {(San Diego,California, ), (Miami,Florida, ), (Syracuse,New York,745691)}

Copyright, Harris Corporation & Ophir Frieder, Relational Terminology, Cont. A tuple is one member of a relation. Example: (Miami,Florida, )

Copyright, Harris Corporation & Ophir Frieder, Relational Terminology, Cont. It is helpful to view a relation as a table, where each row is one tuple and each column is one attribute. Note that the relation may not actually correspond to one table in the final design - for the purposes of performance it may be combined with other tables, or broken into multiple tables. A relational scheme is the set of attributes associated with a relation.

Copyright, Harris Corporation & Ophir Frieder, Example - Relations

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies Depending on the meaning of the attributes some subsets of the Cartesian product are not valid relations.

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies, Cont. Let R be a relational scheme with attributes A 1, A 2,..., A n. Let X and Y be subsets of {A 1, A 2,..., A n }. We say that Y is functionally dependent on X in R, denoted X=>Y, if it is not possible for two distinct tuples in R to have the same value for the attributes in X, and different values for the attributes in Y. Alternatively, we say X functionally determines Y. Informally, if you know the left-hand-side, then you know the right- hand-side.

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies, Cont. SS# => NAME SS# => DATE-OF-BIRTH

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies, Cont. Note that the two functional dependencies: SS# => NAME SS# => DATE-OF-BIRTH Could be represented by the single functional dependency: SS# => NAME, DATE-OF-BIRTH Both representations have advantages, and will be used as appropriate.

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies, Cont. What are all of the possible functional dependencies for the relational scheme R=(SS#,NAME,DATE-OF-BIRTH)? Which of these hold “in the real world?”

Copyright, Harris Corporation & Ophir Frieder, Functional Dependencies, Cont. Functional dependencies are a result of what the attributes mean. A functional dependency is a statement about a relational scheme (i.e., all possible relations), and cannot be deduced from a particular relation. A functional dependency is said to be trivial if. Some functional dependencies can be enforced by a DataBase Management System (DBMS).

Copyright, Harris Corporation & Ophir Frieder, Candidate Key An Informal Definition Let R be a relational scheme. A candidate key for R is a subset of the set of attributes of R, say K, such that –Uniqueness property: No two distinct tuples of R have the same value for K. –Irreducibility property: No proper subset of K has the uniqueness property.

Copyright, Harris Corporation & Ophir Frieder, Candidate Key, Cont. SS# is a candidate key for the following. SS# => NAME SS# => DATE-OF-BIRTH

Copyright, Harris Corporation & Ophir Frieder, Candidate Key, Cont. Which of the following would be candidate keys? SS# NAME DATE-OF-BIRTH SS#, NAME SS#, DATE-OF-BIRTH NAME, DATE-OF-BIRTH

Copyright, Harris Corporation & Ophir Frieder, Candidate Key A More Formal Definition Let R be a relational scheme with attributes A 1, A 2,..., A n and functional dependencies F. In addition, let X be a subset of A 1, A 2,..., A n. Then X is a candidate key for R if –X => A 1, A 2,..., A n is in F +, and –for no proper subset Y of X is it the case that Y => A 1, A 2,..., A n is in F +.

Copyright, Harris Corporation & Ophir Frieder, Closure Of A Set Of Dependencies Question:What is F + ? Answer:F + is the closure of F - the set of all dependencies derivable from F. Equivalently, F + is the set of all dependencies that follow from F by Armstrong’s axioms.

Copyright, Harris Corporation & Ophir Frieder, Armstrong’s Axioms Tangent! Let R be a relational scheme with attributes U and functional dependencies F. Reflexivity - If Y is a subset of X, then X=>Y. Augmentation - If X=>Y, and Z is a subset of U, then XZ=>YZ. Transitivity - If X=>Y and Y=>Z, then X=>Z.

Copyright, Harris Corporation & Ophir Frieder, Keys - Additional Terminology Often times a relation will have more than one candidate key. In such cases one is sometimes designated as the primary key. Any superset of a candidate key is often times referred to as a superkey. Some authors will refer to any candidate key as simply a key, while others will use this to refer to a primary key. Throughout this course, the term key will be used synonymously with the phrase candidate key.