Week 6 Flashcards
What is normalization?
Normalization is the process for evaluating and correcting table structures to minimize data redundancies and data anomalies.
What are the characteristics of well normalized table structures?
The characteristics of well normalized table structure are:
- Each table represents a single subject
- No data item will be unnecessarily stored in more than one table
- All attributes in a table are dependent on the primary key
What are the three normal forms?
The three normal forms are:
1. First normal form (1NF)
2. Second normal form (2NF)
3. Third normal form (3NF)
Why is normalization needed?
Normalization is needed because it:
- Is an important part of designing a new database structure
- Analyses the relationship among the attributes within each entity
- Determines if the structure can be improved
- Improves the existing data structure and creates an appropriate database design(Each table is free from anomalies of insertion, update, and deletion)
What are the steps for normalization?
- Identify dependencies of each table
- Progressively break the table into new set of tables
What is functional dependency?
Functional dependency is where the value of attribute A determines one and only one value of attribute B
What is partial dependency?
Partial dependency is where an attribute value depends on a portion of a composite primary key. For example:
If (A+B) –> (C, D, …)
Where (A+B) is the primary key
If B –> C (C is dependant on B)
Then this would be a partial dependency because attribute C depends on only a part of the composite primary key (Which is B)
What is transitive dependency?
Transitive dependency is where a non-primary key attribute is dependent on another non-primary key attribute. For example:
If (A+B) –> (C, D, …)
Where (A+B) is the primary key
If C –> D (D is dependant on C)
Then this would be a transitive dependency because D is a non-primary key attribute and depends on C which is also a non-primary key attribute.
How do you organise dependencies in a dependency diagram?
Desirable dependencies should go above the diagram, such as dependency based on primary key whereas less desirable dependencies such as partial and transitive dependencies should go below the diagram.
When is a table considered to be in first normal form (1NF)?
A table is considered to be in first normal form (1NF) when:
- There are no repeating groups in the table
- All the key attributes are defined
- All attributes are dependent on the primary key
- All relational tables satisfy 1NF requirements
- May contain other (partial or transitive) dependencies thus subject to data redundancies and various anomalies
When is a table considered to be in second normal form (2NF)?
A table is considered to be in second normal form (2NF) when:
- It is in 1NF and
- It contains no partial dependencies (no attribute is dependant on only a portion of a composite primary key)
When is a table considered to be in third normal form (3NF)?
A table is considered to be in third normal form (3NF) when:
- It is in 2NF and
- It contains no transitive dependencies (no non-primary key is dependent on another non-primary key attribute)
What are the steps for conversion to First Normal Form (NNF –> 1NF)
- Eliminate the repeating groups
- Identify the primary key
- Identify all dependencies
What is a surrogate key?
A surrogate is a system defined attribute that is used when the primary key is considered to be unsuitable. They are created and managed via the DBMS