Department of Computer Science and Engineering, HKUST Slide 1 Finding All the Keys Computationally, finding all the keys can be done by exhaustive search:

Slides:



Advertisements
Similar presentations
Dependency preservation, 3NF revisited and BCNF
Advertisements

Normal forms - 1NF, 2NF and 3NF
Functional Dependencies and Normalization for Relational Databases
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
CS 440 Database Management Systems Practice problems for normalization.
NORMALIZATION. Normalization Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations.
Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
Copyright © 2004 Pearson Education, Inc.. Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Jump to first page Normalization Jump to first page Topics n Why normalization is needed n What causes anomalies n What the 4 normal forms are n How.
Chapter 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Database table design Single table vs. multiple tables Sen Zhang.
Design Guidelines Normalisation Table Design. Informal Design Guidelines Table Semantics A table should hold information about one and only one entity/concept.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Relational Database Design - part 2 - Database Management Systems I Alex Coman,
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Database Design Theory Which tables to have in a database Normalization.
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
7-1 Normalization - Outline  Modification anomalies  Functional dependencies  Major normal forms  Practical concerns.
Department of Computer Science and Engineering, HKUST Slide 1 7. Relational Database Design.
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Normalization B Database Systems Normal Forms Wilhelm Steinbuss Room G1.25, ext. 4041
Introduction to Normalization CPSC 356 Database Ellen Walker Hiram College.
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.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
FEN Quality checking table design: Design Guidelines Normalisation Table Design Is this OK?
Functional Dependencies and Normalization for Relational Databases.
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.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
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.
Lecture No 14 Functional Dependencies & Normalization ( III ) Mar 04 th 2011 Database Systems.
1 Functional Dependencies and Normalization Chapter 15.
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright, Harris Corporation & Ophir Frieder, The Process of Normalization.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
Ch 7: Normalization-Part 1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Decomposition and Normalization Fan Qi
Logical Database Design and Relational Data Model Muhammad Nasir
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Relational Database Design by Dr. S. Sridhar, Ph. D
Problems in Designing Schema
Module 5: Overview of Normalization
Relational Database Design
Review of Week 3 Relation Transforming ERD into Relations
Chapter 7a: Overview of Database Design -- Normalization
Presentation transcript:

Department of Computer Science and Engineering, HKUST Slide 1 Finding All the Keys Computationally, finding all the keys can be done by exhaustive search: –Given a table with 6 attributes, the number of all possible combinations of attributes is: Since testing if a set of attributes is a candidate key or not is not difficult, trying out all 63 possibilities is a breeze for a computer

Department of Computer Science and Engineering, HKUST Slide 2 Heuristics to Reduce the Possibilities Of course, students have to do it by hand (in exams)! Go back to the example in chap6.ppt: R = (A, B, C, G, H, I) F = A  B A  C CG  H CG  I B  H Heuristics can cut down the total combinations from 63 to a few: –Attributes that no other attributes determine must be part of ANY candidate key (i.e., A and G) –Attributes that don’t determine any other attributes but are determined by other attributes should not belong to ANY candidate key (i.e., H and I, which does not conflict with our previous conclusion) –Only 4 possibilities remain: AG, AGB, AGC, AGBC –Since A->B and A-> C, so AG is the only key for R

Department of Computer Science and Engineering, HKUST Slide 3 FDs require just Logical Reasoning The above deductions are just logical reasoning, which are not unique to database design Other “obvious” results can be deduced by reasoning: –R(A,B) is always in BCNF, regardless of what FDs are given –Consider all 4 possibilities: Case 1: no FDs, R must be in BCNF (since no FD can violate BCNF definition!) Case 2: Only A->B, then A is a candidate key, FD does not violate BCNF Case 3: Only B->A, then B is a candidate key, FD does not violate BCNF Case 4: Both A->B and B->A, both A and B are candidate keys; neither FD violates BCNF –There are other “interesting” properties that can be proven by reasoning In real life, FDs may not be very complicated but knowing why FDs affects data redundancy and updates, how to reason on FDs and how to decompose a table help to get a better database design

Department of Computer Science and Engineering, HKUST Slide 4 To Normalize or Not to Normalize, That is the Question Good practice: All tables must be in 3NF, in BNCF if possible Problems with having a lot of tables: –Computational cost is high (a lot of joins, but can create a physical view) –Insertion cost COULD BE high, inserting a set of values into the database may cause several tables to be updated (likewise for deletion) When NOT to normalize (i.e., use a big table)? –High retrieval speed is required –When a table is never updated (e.g., access log for a website), inconsistency and update anomaly due to data redundancy are not concerns –Each transaction generates a large group of data (e.g., IP address, cookies, time, date, URL, etc., in an access log table), appending all the data into a table is more efficient than updating several tables Although a non-normalized table is much bigger than the normalized tables, searching a large table is still much faster than doing joins