Functional dependency: a relationship between two attributes (or sub-sets of attributes) in a relational database, such that the value of the first attribute.

Slides:



Advertisements
Similar presentations
Introduction to SQL 1 Lecture 5. Introduction to SQL 2 Note in different implementations the syntax might slightly differ different features might be.
Advertisements

Functional Dependencies and Normalization for Relational Databases
primary key constraint foreign key constraint
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources.
COP-5725 Practice Exercises
Chapter 3 : Relational Model
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 SQL: Queries, Programming, Triggers Chapter 5 Modified by Donghui Zhang.
CS 440 Database Management Systems Lecture 4: Constraints, Schema Design.
Chapter 3 An Introduction to Relational Databases.
NORMALIZATION. Normalization Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 4 Normalization 2NF & 3NF Presented by: Dr. Samir Tartir.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Extended SQL & The Relational Calculus.
SQL = Sequel = Structured Query Language The Standard Language for Relational Databases.
The Relational Model System Development Life Cycle Normalisation
Relational Algebra - Basic Operations CS263 Lecture 11.
Murali Mani The Relational Model. Murali Mani Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 3 Section 3.4 Relational Database Operators
Relational Algebra Instructor: Mohamed Eltabakh 1.
6.8 Case Study: E-R for Supplier-and-Parts Database
RELATIONAL ALGEBRA Relational Database Handout - 3.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Relational Model Concepts. The relational model represents the database as a collection of relations. Each relation resembles a table of values. A table.
1 ICS 184: Introduction to Data Management Lecture Note 10 SQL as a Query Language (Cont.)
Announcements Read 5.8 – 5.13 for Monday Project Step 3, due Monday 10/18 Homework 4, due Friday 10/15 – by (or turn in Monday in class)
Lecture 1 of Advanced Databases Basic Concepts Instructor: Mr.Ahmed Al Astal.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
FEN Quality checking table design: Design Guidelines Normalisation Table Design Is this OK?
Views. Logical data is how we want to see the current data in our database. Physical data is how this data is actually placed in our database.
1 ICS 184: Introduction to Data Management Lecture Note 11: Assertions, Triggers, and Index.
1 Context “Updating Union, Intersection and Difference views” - introduces a systematic approach to updating a view formed specifically by using  Union.
Functional Dependencies and Normalization for Relational Databases.
Database Management COP4540, SCS, FIU Constraints and security in SQL (Ch. 8.6, Ch22.2)
Normalization Ioan Despi 2 The basic objective of logical modeling: to develop a “good” description of the data, its relationships and its constraints.
1.1 CAS CS 460/660 Relational Model. 1.2 Review E/R Model: Entities, relationships, attributes Cardinalities: 1:1, 1:n, m:1, m:n Keys: superkeys, candidate.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
1 Functional Dependencies and Normalization Chapter 15.
Relational Algebra Operators
Lecture No 13 Functional Dependencies & Normalization ( II ) Mar 3 rd 2011 Database Systems.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Advanced Relational Algebra These slides.
COMP3030 Database Management System Final Review
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Subqueries These slides are licensed under.
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Object-Relational Database Programming.
Relational Algebra p BIT DBMS II.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
44271: Database Design & Implementation Physical Data Modelling Ian Perry Room: C49 Tel Ext.: 7287
Ch 7: Normalization-Part 1
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
Views Prof. Yin-Fu Huang CSIE, NYUST Chapter 10. Advanced Database System Yin-Fu Huang 10.1Introduction Example: Var Good_Supplier View (S Where Status.
Chapter 3 An Introduction to Relational Databases.
Jennifer Widom Indexes. Jennifer Widom Indexes  Primary mechanism to get improved performance on a database  Persistent data structure, stored in database.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Relational Normalization Theory
Generalization.
RELATIONAL ALGEBRA (Chapter 2)
جملة الاستعلام الأساسية
JOINS.
Instructor: Mohamed Eltabakh
Database Management System
EXAMPLE Emp table: SS# Name Age Salary dno 1 Joe Mary 20
Lecture 16 : The Relational Data Model
Database Normalisation
Lecture 16 : The Relational Data Model
Database Dr. Roueida Mohammed.
Copyright © Ellis Cohen
Presentation transcript:

Functional dependency: a relationship between two attributes (or sub-sets of attributes) in a relational database, such that the value of the first attribute determines the value of the second attribute in the same tuple. Examples: SNAME is functionally dependent on S#. (S#  SNAME) SPJ.QTY is functionally dependent on S#, P# and J#. (S#, P#, J#  QTY) 1

2

Let S and T be relations. Let R be the the result of (S PROJECTION over set of attributes P). determinants of S  P INTERSECTION dependants of S 3

SELECT EMP#, ENAME, JOB FROM EMP WHERE JOB = 'Programmer' 4 EMP#ENAMEJOB 1MaryProgrammer 2DuaneProgrammer 8NickProgrammer Functional dependencies include (EMP#  ENAME) and (EMP#  JOB) but not (EMP#  SALARY)

Let S and T be relations. Let R be the result of (S EXTEND BY attribute A). All functional dependencies in S hold true in R. Also, any attributes of A, which were input for the extension operation will be determinants of A 5

SELECT EMP#, ENAME, JOB, CASE WHEN JOB = 'Programmer' THEN 'Full time' ELSE 'Part time' END AS 'STATUS' FROM EMP WHERE JOB = 'Programmer' OR JOB = 'Accountant' 6 EMP#ENAMEJOBSTATUS 1MaryProgrammerFull time 2DuaneProgrammerFull time 5LarryAccountantPart time 8NickProgrammerFull time Functional dependencies include all applicable FDs from S plus (JOB  STATUS) and (EMP#  STATUS)

Let S and T be relations. Let R be the result of (S RESTRICT BY condition C). All functional dependencies in S hold true in R. 7

Let S and T be relations. Let R be the relation resulting from the operation (S U T). Functional dependencies in S and T will not hold true in R. 8

SELECT EMP#, ENAME AS ‘ENAME' FROM EMP WHERE JOB = 'Programmer' UNION SELECT EMP#, 'First Name: ' + ENAME AS ‘ENAME' FROM EMP WHERE JOB = 'Programmer' 9 EMP#ENAME 1Mary 1First Name: Mary 2Duane 2First Name: Duane 8Nick 8First Name: Nick The functional dependency (EMP#  ENAME) does not survive the union.

Let S and T be relations. Let R be the result of operation (S INTERSECT T). All functional dependencies in S and T hold true in R. 10

Let S and T be relations. Let R be a relation resulting from the operation (S – T). All functional dependencies that are true in S will also be true in R. 11

Let S and T be relations. Let R be the result of the natural join of relations S and T on attributes T.a = S.a Kt is a candidate key for T and Ks is a candidate key for S. C is the set of attributes that are common for T and S. Ks U (Kt - C)  Header of R Kt U (Ks - C)  Header of R 12

If A  B and C  D then A U (C – B)  BD 13

SELECT E.EMP#, E.ENAME, E.SALARY, D.LOCATION FROM EMP E, DEPT D WHERE E.DEPT# = D.DEPT# AND E.JOB = ‘Programmer’ 14 EMP#ENAMESALARYLOCATION 1Mary75000Alexandria 2Duane70000Alexandria 8Nick72000Alexandria

{EMP#} U ({DEPT#} – {EMP.DEPT#, DEPT.DEPT#})  HR {EMP#}  HR {DEPT#} U ({EMP#} – EMP.DEPT#, DEPT.DEPT#})  HR {DEPT#, EMP#}  HR HR = {ENAME, SALARY, LOCATION} 15

16 Functional Dependencies include: EMP#  SALARY EMP#  ENAME EMP#  LOCATION

17 Functional dependencies are useful for improving performance, usability and functionality in RDBMS. Functional dependencies in derived tables can be determined from the the functional dependencies in base tables. Rules from this paper have been used to show that views that use a natural join can be updated. Now included in SQL:1999.