Presentation is loading. Please wait.

Presentation is loading. Please wait.

Functional Dependencies

Similar presentations


Presentation on theme: "Functional Dependencies"— Presentation transcript:

1

2 Functional Dependencies
Important concept associated with normalization. Functional dependency describes relationship between attributes. For example, if A and B are attributes of relation R, B is functionally dependent on A (denoted A  B), if each value of A in R is associated with exactly one value of B in R.

3 Characteristics of Functional Dependencies
Property of the meaning or semantics of the attributes in a relation. Diagrammatic representation. The determinant of a functional dependency refers to the attribute or group of attributes on the left-hand side of the arrow.

4 An Example Functional Dependency

5 A Dependency Diagram

6 A Dependency Diagram

7 Try this : identify function dependencies

8 Database Tables and Normalization
Process for evaluating and correcting table structures to minimize data redundancies Reduces data anomalies Series of stages called normal forms: First normal form (1NF) Second normal form (2NF) Third normal form (3NF)

9 Database Tables and Normalization (cont’d.)
Normalization (continued) 2NF is better than 1NF; 3NF is better than 2NF For most business database design purposes, 3NF is as high as needed in normalization Highest level of normalization is not always most desirable Denormalization produces a lower normal form Increased performance but greater data redundancy

10 The Normalization Process
Each table represents a single subject No data item will be unnecessarily stored in more than one table All nonprime attributes in a table are dependent on the primary key Each table is void of insertion, update, deletion anomalies

11 The Normalization Process (cont’d.)
Objective of normalization is to ensure that all tables are in at least 3NF Higher forms are not likely to be encountered in business environment Normalization works one relation at a time Progressively breaks table into new set of relations based on identified dependencies

12 Conversion to First Normal Form
A table is said to be in First Normal Form (1NF) if and only if every entry of the table has at most a single value. Objective: to remove a table’s repeating groups and ensure that all entries of the resulting table have at most a single value.

13 Conversion to First Normal Form (cont’d.)
Step 1: Eliminate the Repeating Groups Eliminate nulls: each repeating group attribute contains an appropriate data value Step 2: Identify the Primary Key Must uniquely identify attribute value New key must be composed

14 Repeating Group example
Group of multiple entries of same type can exist for any single key attribute occurrence

15 Multi-value example

16 First Normal Form (1NF) Step 2 : Identify primary key
Use line# to separate customer order item Step 1 : eliminate repeating group

17 Step 2 : Identify primary key Step 1 : eliminate multi-value
First Normal Form (1NF) Step 2 : Identify primary key Step 1 : eliminate multi-value

18 First Normal Form (1NF)

19 First Normal Form (1NF)

20 (1Nf) Dependency diagram

21 Second Normal Form (2NF)
Table is in second normal form (2NF) if: It is in 1NF and It includes no partial dependencies: No attribute is dependent on only a portion of the primary key

22 Second Normal Form (2NF)

23 Third Normal Form (3Nf) A table is in third normal form (3NF) when both of the following are true: It is in 2NF It contains no transitive dependencies Step 1: Make New Tables to Eliminate Transitive Dependencies Step 2: Reassign Corresponding Dependent Attributes

24 Third Normal Form (3Nf)

25 Final relational schema

26 The Data Dictionary Data dictionary
Used to provide detailed accounting of all tables found within the user/designer-created database Contains (at least) all the attribute names and characteristics for each table in the system Contains metadata—data about data Sometimes described as “the database designer’s database” because it records the design decisions about tables and their structures

27 Sample data dictinary

28 Try this Doing normalization to 3 NF and draw a final schema diagram


Download ppt "Functional Dependencies"

Similar presentations


Ads by Google