Functional Dependency in Databases

Add to Favourites
Post to:

functional dependency,a formal constraint among attributes i.e the main tool for formally measuring the appropriateness of attribute groupings into relation schema.

Type: ppt

Presentation Transcript Presentation Transcript

Functional dependency in Database Management Systems : Functional dependency in Database Management Systems Neenu Prasad

Database Design : Database Design A database design may be performed using two approaches: Bottom-up Top-down. A bottom-up design methodology would consider the basic relationships among individual attributes as the starting point, and it would use those to build up relations. This approach is also called design by synthesis. In contrast, a top-down design methodology would start with a number of groupings of attributes into relations that have already been obtained from conceptual design and mapping activities. Design by analysis is then applied to the relations individually and collectively, leading to further decomposition until all desirable properties are met.

Informal Design Guidelines for Relational Databases : Informal Design Guidelines for Relational Databases It includes 4 guidelines related to: Semantics of the relation attributes Redundant Information in Tuples and Update Anomalies Null values in tuples Spurious tuples

Semantics of the Relation Attributes : Semantics of the Relation Attributes Specifies how the attributes values in a tuple relate to one another. Each tuple in a relation should represent one entity or relationship instance Only foreign keys should be used to refer to other entities Entity and relationship attributes should be kept apart as much as possible Design a schema that can be explained easily relation by relation. The semantics of attributes should be easy to interpret.

PowerPoint Presentation :

PowerPoint Presentation :

Redundant Information in Tuples and Update Anomalies : Redundant Information in Tuples and Update Anomalies Mixing attributes of multiple entities may cause problems Information is stored redundantly wasting storage Problems with update anomalies: Insertion anomalies Deletion anomalies Modification anomalies

EXAMPLE OF AN UPDATE ANOMALY : EXAMPLE OF AN UPDATE ANOMALY Consider the relation: EMP_PROJ ( Emp #, Proj #, Ename , Pname , No_hours ) Update Anomaly Changing the name of project number P1 from “Billing” to “Customer-Accounting” may cause this update to be made for all 100 employees working on project P1 Insert Anomaly Cannot insert a project unless an employee is assigned to . Inversely- Cannot insert an employee unless he/she is assigned to a project.

EXAMPLE OF AN UPDATE ANOMALY (2) : EXAMPLE OF AN UPDATE ANOMALY (2) Delete Anomaly When a project is deleted, it will result in deleting all the employees who work on that project. Alternately, if an employee is the sole employee on a project, deleting that employee would result in deleting the corresponding project. Design a schema that does not suffer from the insertion, deletion and update anomalies. If there are any present, then note them so that applications can be made to take them into account

Null Values in Tuples : Null Values in Tuples Relations should be designed such that their tuples will have as few NULL values as possible Attributes that are NULL frequently could be placed in separate relations (with the primary key) Reasons for nulls: a. attribute not applicable or invalid b. attribute value unkown (may exist) c. value known to exist, but unavailable

Spurious Tuples : Spurious Tuples Bad designs for a relational database may result in erroneous results for certain JOIN operations The "lossless join" property is used to guarantee meaningful results for join operations The relations should be designed to satisfy the lossless join condition. No spurious tuples should be generated by doing a natural-join of any relations

PowerPoint Presentation :

Functional dependency : Functional dependency Constraint b/w2 sets of attributes from the database Denoted by X->Y ,where X and Y are 2 sets of attributes. X->Y means value of X component can be determined by the value of Y and vice versa X->Y also known as X functionally determines Y.

Cont.. : Cont.. Abbreviation for functional dependency is FD. Set of attributes Yis called right-hand side of the FD Set of attributes X is called Left-hand side of the FD X  Y holds if whenever two tuples have the same value for X, they must have the same value for Y If t1[X]=t2[X], then t1[Y]=t2[Y] in any relation instance r(R)

Inference Rules for FDs : Inference Rules for FDs Given a set of FDs F, we can infer additional FDs that hold whenever the FDs in F hold Armstrong's inference rules A1. ( Reflexive ) If Y subset-of X, then X  Y A2. ( Augmentation ) If X  Y, then XZ  YZ (Notation: XZ stands for X U Z) A3. ( Transitive ) If X  Y and Y  Z, then X  Z A1, A2, A3 form a sound and complete set of inference rules

Additional Useful Inference Rules : Additional Useful Inference Rules Decomposition If X  YZ, then X  Y and X  Z Union If X  Y and X  Z, then X  YZ Psuedotransitivity If X  Y and WY  Z, then WX  Z Closure of a set F of FDs is the set F+ of all FDs that can be inferred from F

Neenu Prasad
Looking to Learn for computer subjects

Your Facebook Friends on WizIQ