Download presentation
Presentation is loading. Please wait.
Published byColeen Park Modified over 9 years ago
1
Database Design (Normalizations) DCO11310 Database Systems and Design By Rose Chang
2
Logical Data Model 1.Build a Conceptual Data Model 2.Build and validate logical data model (LDM) Drive relations for LDM Validate relations using normalisation Validate relations against user transactions Check integrity constraints Review LDM with user Merge LDMs into global model
3
Top-down Modeling Entity - Entity - Entity DATABASE Table - Table – Table - Table - Table Attributes + Constraints Attributes + Constraints Attributes + Constraints Attributes + Constraints Attributes + Constraints
4
Bottom-up Modeling Entity - Entity - Entity DATABASE Table - Table – Table - Table - Table Attributes + Constraints Attributes + Constraints Attributes + Constraints Attributes + Constraints Attributes + Constraints
5
Normalizations A process that assigns attributes to entities in such a way that data redundancies are reduced or eliminated Enables us to analyse the design of the database Identify the existence of potential data anomalies result from those redundancies A step to step process : given a data model and the relevant FDs Decomposition of relation schema based on knowledge of underlying functional dependencies Results in a relational schema that satisfies certain important criteria: 1NF, 2NF, 3NF, BCNF, 4NF, … E.G., No anomalies, no spurious or invalid data during joins
6
Update Anomalies Redundancies Information fact is stored in more than one place Insertion anomalies Unable to insert a fact into table without having other facts (or inserting nulls) Deletion anomalies If a set of values becomes empty, we may lose other information as a side effect Modification anomalies Change the information in one tuple but leave information unchanged in another
7
Example Real bad design: Study(Sid,name,Dept,Course_code, Course_name) SidNameDeptC_codeC_Name S01RoseDCO20401DB S01RoseDCO30198Project S02PeterDCO20401DB S03MaryDCO30198Project S04TomDCO20401DB
8
What are the Anomalies? Redundancy Insertion Anomaly Deletion Anomaly What is the best design for this information? No anomalies Can reconstruct all original information
9
Process of Normalization UsersUser’s requirement Forms/ Report Other sources From company Data sources UNF Transfer attributes into table format 1NF Remove repeating group 2NF Remove partial dependencies 3NF Remove transitive dependencies
10
Normalizations Unnormalised Form (UNF) can be captured from data entities generated in System Analysis phase sample reports or screens Invoice Stf_name: Rose C W ChangStf_ID. : 50121456 Dept: SalesDpt_Code: SAL Item CodeItem DescriptionPrice I011Wing-Type-A70 I012Wing-Type-B60 I013Engine-Type-A70 Total 200
11
First Normal Form A relation is in first normal form (1NF) if and only if All the key attributes are defined There are no repeating groups in the table All non-primary-key attribute is functionally dependent on the primary key Problem : attributes not necessary fully functionally dependent
12
Functional Dependencies Attribute B is functionally dependent on attribute A if and only if each value of A is associated with precisely one value of B at any one time E.G. Stf_name is functionally dependent on Stf_ID, Stf_ID Stf_name The attribute on the left is a determinant
13
First Normal Form (1NF) Eliminate repeating groups of data items UNF1NFStf_IDStf_nameDept_codeDept_name {Item_code Item_descStf_ID Price }Item_code Item_desc Price
14
Second Normal Form A relation is in second normal form (2NF) if and only if It is in 1NF All non-primary-key attribute is fully functionally dependent on the primary key, that is, there is no partial dependecy.
15
Full Functional Dependency Attribute B is fully functionally dependent (FD) on attribute A if it is functionally dependent on A and NOT functionally dependent on any subset of A All determinants in each relation are candidate keys
16
1NF2NFStf_IDStf_nameDept_codeDept_name Stf_IDStf_IDItem_code Item_codeItem_codeItem_desc Item_descPrice Price Second Normal Form (2NF) Record is in 1NF and no partly dependencies
17
Third Normal Form A relation is in third normal form (3NF) if and only if It is in 2NF It contains NO transitive dependencies transitive dependencies A condition where A, B, and C are attributes of a relation such that if A B and B C, then C is transitively dependent on A via B (provided that A is not FD on B or C)
18
Third Normal Form (3NF) Record is in 2NF and no transitive dependencies (no fields dependent on nonkey field(s)) 2NF3NF Stf_IDStf_IDDept_code Stf_nameStf_nameDept_nameDept_code Dept_name Stf_IDItem_code Stf_IDItem_codeItem_codeItem_desc Item_codeItem_descPrice Price
19
E/R Model after Normalization StaffSold Items Item Dept
20
Normalize it to 3NF
21
Q & A Readings: Connolly: Ch13, except BCNF, 4NF & 5NF
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.