Normalization: Bottom-Up Design

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the main purpose of database normalization?

To minimize redundancy in a relation and avoid insertion, deletion, and update anomalies by decomposing relations into smaller, well-structured relations.

Which of the following issues can arise from data redundancy in a relation?

  • Insertion anomalies
  • Deletion anomalies
  • Update anomalies
  • All of the above (correct)

What is a functional dependency (FD)?

A relationship between attributes in a table where the value of one attribute (or set of attributes) determines the value of another attribute.

Explain the difference between partial dependency and full dependency.

<p>A full dependency (X -&gt; Y) exists when Y is functionally dependent on X, and no attribute can be removed from X without breaking the dependency. A partial dependency exists if Y depends on only a part of a composite primary key X.</p> Signup and view all the answers

What is a transitive dependency?

<p>A transitive dependency occurs when a non-key attribute is functionally dependent on another non-key attribute, which in turn is functionally dependent on the primary key. (e.g., X -&gt; Y and Y -&gt; Z, where X is the key and Y is not).</p> Signup and view all the answers

Which anomaly occurs when deleting a record unintentionally removes data about another entity?

<p>Delete Anomaly (B)</p> Signup and view all the answers

Which anomaly occurs when inconsistent data is created because updating information requires changes in multiple places?

<p>Update Anomaly (D)</p> Signup and view all the answers

Which anomaly prevents adding information about a new entity until another related entity exists?

<p>Insert Anomaly (B)</p> Signup and view all the answers

What are the conditions for a relation to be in First Normal Form (1NF)?

<ol> <li>There are no repeating groups (each cell contains a single, atomic value). 2. A unique primary key has been identified. 3. All attributes are functionally dependent on the primary key (or part of it).</li> </ol> Signup and view all the answers

What are the conditions for a relation to be in Second Normal Form (2NF)?

<ol> <li>The relation must be in 1NF. 2. All non-key attributes must be fully functionally dependent on the entire primary key (no partial dependencies).</li> </ol> Signup and view all the answers

What are the conditions for a relation to be in Third Normal Form (3NF)?

<ol> <li>The relation must be in 2NF. 2. There must be no transitive dependencies (non-key attributes cannot depend on other non-key attributes).</li> </ol> Signup and view all the answers

What are the conditions for a relation to be in Boyce-Codd Normal Form (BCNF)?

<ol> <li>The relation must be in 3NF. 2. Every determinant must be a candidate key.</li> </ol> Signup and view all the answers

A relation in BCNF is always in 3NF.

<p>True (A)</p> Signup and view all the answers

A relation in 3NF is always in BCNF.

<p>False (B)</p> Signup and view all the answers

What does it mean for an attribute value to be 'atomic' in the context of 1NF?

<p>It means the value cannot be further subdivided or be a set/compound structure; each cell in the table holds only a single, indivisible value.</p> Signup and view all the answers

The process of normalization typically involves decomposing tables, which can sometimes lead to more tables in the database.

<p>True (A)</p> Signup and view all the answers

Consider the functional dependency {SSN, PNUMBER} -> HOURS. Is this typically a full or partial dependency, assuming {SSN, PNUMBER} is the primary key?

<p>Full dependency</p> Signup and view all the answers

Consider the functional dependencies EmpID -> DeptName and DeptName -> DeptLocation. If EmpID is the primary key, what type of dependency is EmpID -> DeptLocation?

<p>Transitive dependency</p> Signup and view all the answers

A table with multi-valued attributes (e.g., multiple phone numbers in one field) is not in which normal form?

<p>1NF (B)</p> Signup and view all the answers

Flashcards

Relational Database Design

Transforming an ER Model to a Relational Schema for implementation.

Top-Down Design

Identifying entity types and defining each entity's attributes.

Bottom-Up Design

Begins by defining attributes and grouping them to form entities.

Normalization

The process of minimizing redundancy in a relation to prevent anomalies.

Signup and view all the flashcards

Data Redundancy

Data appears multiple times, wasting space and increasing the likelihood of inconsistencies.

Signup and view all the flashcards

Decomposing Relations

Breaking down relations to eliminate anomalies and improve data structure.

Signup and view all the flashcards

Normalization of User Views

Represent user views as relations, normalize, and combine based on primary keys.

Signup and view all the flashcards

Functional Dependency

Way of describing interactions of attributes within a relation.

Signup and view all the flashcards

Determinant

Attribute that determines another, written X -> Y.

Signup and view all the flashcards

Full Dependency

Y is fully dependent on X; no attribute can be removed from X.

Signup and view all the flashcards

Partial Dependency

Y is partially dependent on X; an attribute can be removed from X.

Signup and view all the flashcards

Transitive Dependency

FD X->Z derived from X->Y and Y->Z; X is primary key and Y is not a candidate key.

Signup and view all the flashcards

Trivial Dependency

Dependency that holds true for all tuples in the relation.

Signup and view all the flashcards

Insertion Anomaly

A row or tuple is added to a table that violates its structure.

Signup and view all the flashcards

Deletion Anomaly

A row or tuple is deleted from a table and causes data loss.

Signup and view all the flashcards

Update Anomaly

Update to a piece of data causes an inconsistent state.

Signup and view all the flashcards

Design Errors in Relations

Relations with potential design errors categorized for correction.

Signup and view all the flashcards

Eliminating Errors

Normal forms successively eliminate data errors.

Signup and view all the flashcards

Normal Forms

1NF, 2NF, 3NF, BCNF, 4NF, 5NF.

Signup and view all the flashcards

First Normal Form (1NF)

Table format with no repeating groups.

Signup and view all the flashcards

Second Normal Form (2NF)

1NF, and all non-key fully dependent on the entire key.

Signup and view all the flashcards

Third Normal Form (3NF)

2NF, and all transitive dependencies removed.

Signup and view all the flashcards

Boyce-Codd Normal Form (BCNF)

Every determinant is a candidate key.

Signup and view all the flashcards

Fourth Normal Form (4NF)

Relation should be is in BCNF, and any multivalued dependencies have been removed

Signup and view all the flashcards

Fifth Normal Form (5NF)

Relation should be in 4NF and any remaining anomalies that result from join dependencies have been removed.

Signup and view all the flashcards

Atomic Value

Standard def: each attribute value is atomic

Signup and view all the flashcards

Un-normalized Form (UNF)

Relation with non-atomic attribute values, repeating groups

Signup and view all the flashcards

Partial Functional Dependency

Non-key attribute partially dependent on the key

Signup and view all the flashcards

Transitive Dependency

Non-key attribute dependent on another non-key attribute

Signup and view all the flashcards

Partial Dependency

This occurs when non-key attributes are dependent on part of a composite primary key.

Signup and view all the flashcards

Transitive Dependency

A non-key attribute determines another.

Signup and view all the flashcards

Study Notes

  • This lecture focuses on Normalization
  • Normalization involves two approaches in relational database design

Top-Down Design

  • This process involves identifying different entity types.
  • It also includes defining each entity's attributes.

Bottom-Up Design

  • This process defines attributes first.
  • It then groups them to form entities.
  • This lecture focuses on bottom-up design.
  • Normalization is minimizing redundancy from a relation.
  • Redundancy causes insertion, deletion, and update anomalies.
  • Data redundancy increases database size unnecessarily.
  • It is caused by the same data repeated in many places.
  • Decomposing relations with anomalies yields smaller, well-structured relations.

Normalization of User View Relations (Bottom-Up Design)

  • The first step is representing all user views (forms, reports, etc.) as a collection of relations.
  • The next step is normalizing these relations, user view by user view.
  • Each view should be broken down into fundamental tables based on normalization principles, aiming for 3NF.
  • Finally, combine relations with the same primary key(s).
  • This is done because they may represent the same entity.
  • Functional Dependency describes attribute interactions.
  • Functional dependency is when a simplest kind of dependency.
  • Given this LecturereID → LecturerName, all statements are deemed equivalent: - For each LecturerID there should be at most one LecturerNan - LecturerName is determined by LecturerID - LecturerName is uniquely determined by LecturerID - LecturerName depends on LecturerID

Full vs Partial Dependency

  • X implies Y ( X → Y ) is a full dependency if no attribute can be removed from X.
  • X implies Y ( X → Y ) is a partial dependency if an attribute can be removed from X.
  • Both X and Y are subsets of attributes.

Examples of Full vs Partial Dependency

  • LecturerID, SubjectCode → LecturerName is partial.
  • LecturerName depends partially on LecturerID and SubjectCode.
  • LabDate, SubjectCode → Tutor is full
  • Tutor is fully dependent on both LabDate and SubjectCode.

Transitive Dependency

  • Consider FD X -> Z derived from FDs X -> Y and Y -> Z.
  • This is considered a problem with X as the primary key.
  • This is only a problem if Y is not a candidate key.

Some Definitions

  • Attribute X implying attribute Y (X -> Y) holds if two tuples or rows having the same value across attribute X results in that same value across attribute Y
  • "Social security number determines employee name", i.e. SSN -> ENAME
  • Means that a table containing social security numbers, the user only needs to use SSN to retrieve the Ename - no other values or fields needed
  • Project Number determines both Project Name and Location i.e. Pnumber -> {Pname Plocation}
  • This means a table containing the hours an employee works on a project, the user must use the project number to access name and location of the project

Functional dependency

  • Employee Social Security Number and Project Number determine the hours per week worked i.e. { SSN, Pnumber} -> Hours
  • A table containing employee details would require these two to determine the hours, no other fields or values would work If "given {SSN, Pnumber} -> Ename" then for employee name, this can be determined by either SSN or Pnumber alone which means on of the values is redundant and we can remove this to form the "functional join"

Anomalies

Examples that occur in poorly structured tables If a new subject has no allocated lecturer yet then the details on this subject cannot be added to the table due to an insertion anomaly If an existing Subject has changed title then there is a need to change changes to multiple instances only. A failure to update can cause an update anomaly If a lecturer resigns and has their data deleted then there is a possibility that some subjects will be permanently removed due to a deletion anomaly

Normal Forms

  • Design errors in relations can be categorized, including potential anomaly types.
  • These categories can be successively eliminated through decomposition into normal forms.
  • The major normal forms are:
  • First Normal Form (1NF)
  • Second Normal Form (2NF)
  • Third Normal Form (3NF)
  • Boyce-Codd Normal Form (BCNF).
  • Higher/advanced forms include Fourth (4NF) and Fifth (5NF).
  • Problems with 4NF and 5NF rarely occur.
  • Database designers usually focus on satisfying 3NF and BCNF. Satisfying 3NF and BCNF is done since designers don't need the highest possible NF.
  • The forms become increasingly stricter and error-free.
  • Advanced normal forms are based on complex dependencies

First Normal Form

  • A relation is in 1NF if: - There are no repeating groups. - A unique key has been identified for each relation. - All attributes are functionally dependent on all or part of the key.

Second Normal Form

  • A relation is in 2NF if: - The relation is in 1NF. - All non-key attributes are fully functionally dependent on the entire key. - All partial dependencies have been removed.

Third Normal Form

  • A relation is in 3NF if:
    • The relation is in 2NF.
      • All transitive dependencies have been removed.
      • Transitive dependency: non-key attribute dependent on another non-key attribute.

Boyce-Codd Normal Form

  • A relation is in BCNF if: - The relation is in 3NF. - Any remaining functional dependency-related anomalies are removed.

Fourth Normal Form

  • A relation is in 4NF if: - The relation is in BCNF. - Any multi-valued dependencies are removed.

Fifth Normal Form

  • A relation is in 5NF if: - The relation is in 4NF. - Any remaining join dependency-related anomalies are removed. The standard definition of a relation requires attribute values to be atomic - It should not be a set or compound structure. Relations should have only single value attributes

An Un-Normalized Definition

  • Any relation which contains non-atomic attribute values (repeating groups) is considered to be in un-normalized form
  • A non BCNF table: There is a rule enforced stating that a given customer can only be served by one salesperson per branch A new model no longer enforces said rule i.e. it's now possible for a customer to now be supported by several salepeople at any particular branch Generic Format: 3NF but not BCNF : r1 { a,b,c such that c will determine B converted BNCF: r11 {a,c} and r12 {c,b}

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser