1. Home
  2. Explore
  3. Computer Science
  4. Database Design and Normalization

Study methods

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

Database Design and Normalization

  • 70Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Database Implementation
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is the general goal of moving from a conceptual data model to a database design?

Tap to flipClick to flipspace

To turn conceptual entities and relationships into structures that can be implemented in a real-world database.

Or swipe the card

70 cards

  1. What is the general goal of moving from a conceptual data model to a database design?

    To turn conceptual entities and relationships into structures that can be implemented in a real-world database.

  2. How does a relation’s parenthetical notation indicate its primary key?

    The primary-key attribute is underlined; the other listed attributes are non-key attributes.

  3. What is the first major step in implementing an entity-based data model?

    Create a database table for each entity in the data model.

  4. What key must every database table have?

    A primary key.

  5. What column properties should be specified when designing a database table?

    Data type, nullability, default value if applicable, and any integrity constraints.

  6. What are examples of data types that might be assigned to a database column?

    Integer, float, varchar, or date-time.

  7. What does a column’s null status specify?

    Whether the column is allowed to contain null values.

  8. What is a default value for a database column?

    A value the database can supply automatically when no value is provided for that column.

  9. What are two examples of constraints that can protect column integrity?

    A range constraint and a constraint limiting values to a predefined acceptable set.

  10. Why might a table’s structure need to be reconsidered after its initial design?

    Normalization or a justified denormalization decision may require changes to the table structure.

  11. What is a functional dependency?

    A relationship in which the value of one attribute determines the value of another attribute or set of attributes.

  12. What is a determinant in a relation?

    An attribute, or set of attributes, whose value determines the values of other attributes in the relation.

  13. What is a candidate key?

    An attribute or set of attributes whose values determine every other non-key attribute in a row.

  14. What is the difference between a simple and a composite candidate key?

    A simple candidate key uses one attribute; a composite candidate key combines two or more attributes.

  15. What is a modification anomaly?

    A problem that arises when inserting, updating, or deleting data in a poorly normalized table.

  16. What is an insertion anomaly?

    A problem or unwanted side effect that occurs when adding data to a table.

  17. What is an update anomaly?

    A problem in which the same fact must be updated in multiple rows to keep the data consistent.

  18. What is a deletion anomaly?

    A problem in which deleting one fact unintentionally removes other information that should be preserved.

  19. How does normalization help prevent modification anomalies?

    It breaks a table containing multiple business concepts into smaller, related tables.

  20. What does First Normal Form (1NF) mean in the described normalization process?

    Every relation is, by definition, in 1NF.

  21. What must be removed from a table in 1NF for it to meet Second Normal Form (2NF)?

    Partial dependencies.

  22. What must be removed from a table in 2NF for it to meet Third Normal Form (3NF)?

    Transitive dependencies.

  23. What is the defining condition of Boyce-Codd Normal Form (BCNF)?

    Every determinant in the table is also a candidate key.

  24. At what level of normalization is a relation considered normalized for the purposes described?

    When every determinant is a candidate key—that is, when it is in BCNF.

  25. What is the relationship between BCNF and 3NF?

    BCNF is slightly more stringent than 3NF and is sometimes called 3.5NF.

  26. What does a design in 3NF or above generally avoid, and what is it usually sufficient for?

    It generally avoids modification anomalies and is almost always sufficient for business data needs.

  27. In the customer-accountant example, why is the original customer table not normalized?

    Some non-key attributes depend on attributes other than the customer ID: city and state depend on ZIP code, while accountant name and phone depend on accountant ID.

  28. Why can a ZIP code determine city and state in the customer-accountant example?

    Because each ZIP code identifies the city and state to which it applies.

  29. How is the customer-accountant example divided into tables when normalized?

    Into Customer, ZIP Code, and Accountant tables.

  30. What are the primary keys and non-key attributes in the normalized ZIP Code and Accountant tables?

    ZIP Code uses ZIP as its primary key, with city and state as attributes. Accountant uses accountant ID as its primary key, with accountant name and phone as attributes.

  31. What is denormalization?

    Combining two or more tables into one when there is a justified business need.

  32. What are two common reasons to denormalize a database design?

    To simplify the design and to improve query speed.

  33. How can combining Customer and ZIP Code tables improve address-query performance?

    It allows a customer’s full address to be read without joining the ZIP Code table.

  34. What is a potential performance cost of joining relational tables?

    Joins require computational work and time, which can slow query performance.

  35. What design and SQL advantages can denormalization provide?

    It can reduce the number of tables, make the design easier to understand, and simplify maintenance and SQL writing.

  36. What data-quality risks can arise when city and state are repeated in a denormalized Customer table?

    Redundant data and inconsistent entries, such as spelling out a state in some rows and abbreviating it in others.

  37. What is the central trade-off of denormalization?

    Potential gains in simplicity and query speed come with a greater risk of modification anomalies and inconsistent data.

  38. When should a database design be denormalized?

    Only when there is a defensible business reason for doing so.

  39. What can be used to help prevent data problems in a denormalized design, and what is the drawback?

    Database constraints or software validity checks can help, but they add overhead and may reduce the simplicity gains.

  40. How are tables linked to represent a relationship in a relational database?

    By linking a primary key in one table to a foreign key in another.

  41. In a one-to-one binary relationship where both sides are optional, where can the foreign key go?

    In either table; choose the placement that makes the most conceptual sense.

  42. In a one-to-one binary relationship where only one side is optional, where should the foreign key usually go?

    In the table on the optional side of the relationship.

  43. For an optional one-to-one Employee–Locker relationship, where can the foreign key be placed?

    In either Employee or Locker, depending on which direction is more conceptually natural.

  44. In the Patient–Bed example, which table contains the foreign key, and why?

    Patient contains the bed ID as a foreign key because the patient side is mandatory, while a bed may be unassigned.

  45. How can a one-to-one SQL join be performed when a foreign key is stored in Employee?

    Join Employee and Locker by matching their locker ID values.

  46. How can a one-to-one SQL join be performed when Employee ID is stored as a foreign key in Locker?

    Join Employee and Locker by matching their employee ID values.

  47. In a one-to-many binary relationship, which table receives the foreign key?

    The table on the many side.

  48. In a one-to-many relationship, what are the parent and child tables?

    The one-side table is the parent; the many-side table is the child.

  49. In the Team–Player example, where is Team ID stored as a foreign key?

    In the Player table, because Player is on the many side.

  50. How can two tables in a one-to-many relationship be joined in SQL?

    Join the matching primary-key and foreign-key values, using either a join in the FROM clause or a condition in the WHERE clause.

  51. Why can’t a many-to-many relationship be implemented directly between two tables in the described relational design?

    It requires an intersection table between the two parent tables.

  52. What is the typical primary key for a many-to-many intersection table?

    A composite key made from the primary keys of the two parent tables.

  53. How do the columns of a composite-key intersection table serve two purposes?

    Together they form the intersection table’s primary key; individually they are foreign keys to the parent tables.

  54. How would you query students and the classes they have taken through a Student_Class intersection table?

    Join Student to Student_Class on student ID, then join Student_Class to Class on class number.

  55. What is an associative entity?

    An intersection table that contains additional non-key attributes.

  56. In the Student–Class example, what does the Grade attribute in Student_Class represent?

    The student’s performance in a particular class.

  57. What restriction does a composite primary key place on pairings in an associative entity?

    Each possible pair of parent-key values can appear at most once.

  58. What is the effect of using a surrogate key instead of a composite key in an associative entity?

    The parent keys become ordinary foreign keys, so the same pair of parent values can appear multiple times unless separately restricted.

  59. In a customer-product Rating table with a composite primary key of customer ID and product ID, how often can one customer rate one product?

    At most once.

  60. In a Rating table with a surrogate Rating ID primary key, what does the design allow for customer-product pairs?

    A customer-product pair can potentially appear multiple times, allowing repeated ratings.

  61. What is a recursive relationship?

    A relationship in which a table is related to itself.

  62. How is a one-to-one recursive relationship implemented?

    Place a foreign key in the same table.

  63. How is a one-to-many recursive relationship implemented?

    Place a foreign key in the same table to reference the related row.

  64. How is a many-to-many recursive relationship implemented?

    Use an intersection table to link rows of the table to one another.

  65. In the sponsorship example, what does the one-to-one recursive relationship allow?

    Each person may be sponsored by zero or one other person.

  66. In the customer referral example, what is the recursive cardinality?

    A customer may refer many customers, while each customer is referred by at most one customer.

  67. In the doctor-treatment example, why is the recursive relationship many-to-many?

    A doctor may treat many other doctors, and may also be treated by many other doctors.

  68. How do SQL queries join a table to itself for a one-to-one or one-to-many recursive relationship?

    Reference the same table twice using different aliases, then join the two instances.

  69. How can a query find customers referred by a specific customer in a recursive referral relationship?

    Join two aliased instances of Customer using the referral foreign key, then filter for the chosen referring customer.

  70. How does SQL query a many-to-many recursive relationship?

    Use two aliased instances of the same table and join both to the intersection table.

Card 1 of 70
Card 1 of 70

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent