1. Home
  2. Explore
  3. Computer Science
  4. Database Normalization Overview

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Database Normalization Overview

  • 18Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Normalization Basics

What is the primary purpose of database normalization?

18 questions

  1. 1

    What is the primary purpose of database normalization?

    1. A

      To reduce the number of tables in a database

    2. B

      To ensure all tables have a composite primary key

    3. C

      To avoid data redundancy and attain data integrity

    4. D

      To increase data redundancy for faster queries

    Correct answer
    C

    To avoid data redundancy and attain data integrity

    Explanation

    Normalization aims to avoid data redundancy and attain data integrity, as stated in the content.

  2. 2

    What type of anomaly occurs when a new agency cannot be inserted because it has no agent yet?

    1. A

      Delete anomaly

    2. B

      Read anomaly

    3. C

      Insert anomaly

    4. D

      Update anomaly

    Correct answer
    C

    Insert anomaly

    Explanation

    The inability to insert a new agency because the primary key (AgentId) would be null is an insert anomaly.

  3. 3

    Which anomaly arises when updating data in multiple rows leads to inconsistent state if some rows are not updated?

    1. A

      Read anomaly

    2. B

      Insert anomaly

    3. C

      Update anomaly

    4. D

      Delete anomaly

    Correct answer
    C

    Update anomaly

    Explanation

    Update anomaly occurs due to data redundancy; updating only some rows causes inconsistency.

  4. 4

    What happens if a delete operation removes an agent and also inadvertently removes the agency and client information?

    1. A

      Update anomaly

    2. B

      Insert anomaly

    3. C

      Delete anomaly

    4. D

      Referential integrity violation

    Correct answer
    C

    Delete anomaly

    Explanation

    Deleting an agent removes the associated agency and client data, which is a delete anomaly.

  5. 5

    Why is the denormalized FilmAgents table not in 1NF?

    1. A

      It has a primary key that allows null values

    2. B

      It violates the rule of atomicity for agent names

    3. C

      It has data redundancy in agency name and location

    4. D

      It contains a group of columns representing similar information (customer1, customer2, customer3)

    Correct answer
    D

    It contains a group of columns representing similar information (customer1, customer2, customer3)

    Explanation

    1NF prohibits groups of columns representing similar information; here customer1, customer2, customer3 are such a group.

  6. 6

    According to 1NF, what must be true about each column value?

    1. A

      It must be part of a composite key

    2. B

      It must not contain any null values

    3. C

      It must be unique across the table

    4. D

      It must be atomic (single value)

    Correct answer
    D

    It must be atomic (single value)

    Explanation

    1NF requires each column to be atomic, meaning a single value per column per row.

  7. 7

    Which of the following is NOT a requirement for a table to be in 1NF?

    1. A

      All non-key columns must be dependent on the primary key

    2. B

      Each column must contain atomic values

    3. C

      There must be a primary key that uniquely identifies each row

    4. D

      There should be no repeating groups of columns

    Correct answer
    A

    All non-key columns must be dependent on the primary key

    Explanation

    The requirement that non-key columns depend on the primary key is part of 2NF, not 1NF.

  8. 8

    After achieving 1NF by splitting into AgentInfo and CustomerInfo tables, which anomaly is resolved?

    1. A

      The inability to sort by customer name

    2. B

      Delete anomaly for removing an agent with multiple customers

    3. C

      Insert anomaly for a new agency without an agent

    4. D

      Update anomaly for change in agency location

    Correct answer
    A

    The inability to sort by customer name

    Explanation

    With a single customer name column, sorting becomes possible, resolving the read issue.

  9. 9

    What condition must a table satisfy to be in 2NF?

    1. A

      Each table must have a single purpose

    2. B

      All columns must be atomic and there must be a primary key

    3. C

      All non-key columns must be fully functionally dependent on the primary key

    4. D

      All non-key columns must be dependent on the primary key and no transitive dependencies

    Correct answer
    D

    All non-key columns must be dependent on the primary key and no transitive dependencies

    Explanation

    2NF requires compliance with 1NF and that all non-key columns are dependent on the primary key (no partial dependencies for composite keys; here the rule is simplified to 'non-key columns should be dependent on primary key').

  10. 10

    In the AgentInfo table after 1NF, why is it not in 2NF?

    1. A

      There is no foreign key to an agency table

    2. B

      AgencyName, OfficeLocation, and OfficeContact describe the agency, not the agent

    3. C

      The table has a composite primary key

    4. D

      AgentName is not dependent on AgentId

    Correct answer
    B

    AgencyName, OfficeLocation, and OfficeContact describe the agency, not the agent

    Explanation

    Non-key columns like AgencyName describe the agency, not the agent (the entity identified by the primary key), violating the dependency rule of 2NF.

  11. 11

    How is the 2NF violation resolved in the AgentInfo table?

    1. A

      By creating a join table between agents and customers

    2. B

      By removing the AgencyId foreign key

    3. C

      By splitting the table into AgentInfo and AgencyInfo, linking them via a foreign key

    4. D

      By adding more columns to describe the agent

    Correct answer
    C

    By splitting the table into AgentInfo and AgencyInfo, linking them via a foreign key

    Explanation

    To achieve 2NF, columns describing the agency are moved into a separate AgencyInfo table, with a foreign key (AgencyId) in AgentInfo.

  12. 12

    In the CustomerInfo table after 2NF, what transitive dependency exists?

    1. A

      CustPinCode depends on CustCity, and CustCity depends on CId

    2. B

      CustName depends on CId

    3. C

      CustPinCode depends directly on CId

    4. D

      CustCity depends on CId

    Correct answer
    A

    CustPinCode depends on CustCity, and CustCity depends on CId

    Explanation

    CustPinCode is transitively dependent on CId through CustCity, which violates 3NF.

  13. 13

    What is the rule for a table to be in 3NF?

    1. A

      All non-key columns must be directly dependent on the primary key, with no transitive dependencies

    2. B

      There must be a composite primary key

    3. C

      All non-key columns must be dependent on the primary key, but transitive dependencies are allowed

    4. D

      All columns must be atomic

    Correct answer
    A

    All non-key columns must be directly dependent on the primary key, with no transitive dependencies

    Explanation

    3NF requires 2NF and that non-key columns are non-transitively (directly) dependent on the primary key.

  14. 14

    How is the CustomerInfo table made 3NF compliant?

    1. A

      By combining CustCity and CustPinCode into one column

    2. B

      By making CustPinCode the primary key

    3. C

      By removing the CustPinCode column

    4. D

      By creating a separate CustomerPinCodes table with CustPinCode and CustCity

    Correct answer
    D

    By creating a separate CustomerPinCodes table with CustPinCode and CustCity

    Explanation

    To eliminate transitive dependency, CustPinCode and CustCity are moved to a new table where CustPinCode becomes a foreign key referencing the new table.

  15. 15

    What is the purpose of a join table (intersection table) in a normalized database?

    1. A

      To store primary keys of two tables and represent a many-to-many relationship

    2. B

      To ensure all tables have a single purpose

    3. C

      To store non-key attributes that are dependent on multiple tables

    4. D

      To combine multiple tables into one for faster queries

    Correct answer
    A

    To store primary keys of two tables and represent a many-to-many relationship

    Explanation

    Join tables are used to represent many-to-many relationships by containing foreign keys from both tables.

  16. 16

    Which normal form is generally considered sufficient for a normalized database?

    1. A

      BCNF

    2. B

      2NF

    3. C

      1NF

    4. D

      3NF

    Correct answer
    D

    3NF

    Explanation

    The content states that if a database is in 3NF, it is sufficiently normalized.

  17. 17

    In the denormalized FilmAgents table, what is the primary key?

    1. A

      AgentId

    2. B

      AgencyName

    3. C

      Customer1

    4. D

      AgentName

    Correct answer
    A

    AgentId

    Explanation

    The content explicitly states that AgentId is the primary key in the denormalized table.

  18. 18

    What issue arises when trying to find the agency for a customer in the denormalized table?

    1. A

      The data is stored in multiple tables

    2. B

      Null values in customer columns cause errors

    3. C

      The query must involve multiple OR conditions on several customer columns

    4. D

      The primary key constraint prevents such a query

    Correct answer
    C

    The query must involve multiple OR conditions on several customer columns

    Explanation

    To find the agency for a customer like Mr. Freeman, a query must check multiple customer columns (customer1, customer2, customer3) using OR conditions.

Question 1 of 18
Question 1 of 18

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent