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

  • 59Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Database Implementation

What is the overall purpose of moving from a conceptual data model to a database design?

59 questions

  1. 1

    What is the overall purpose of moving from a conceptual data model to a database design?

    Model answer

    It is to turn conceptual relations and entities into data structures that can be implemented in a real database.

    Explanation

    Implementation requires design decisions beyond identifying the entities, including how tables and their columns will be defined.

  2. 2

    How is a relation commonly represented, and what does an underlined attribute indicate?

    Model answer

    A relation can be described by listing its attributes in parentheses; an underlined attribute indicates the primary key.

    Explanation

    For example, an item relation may show its item ID underlined and its other attributes as non-key attributes.

  3. 3

    Why is an entity model not, by itself, sufficient to implement a database table?

    Model answer

    Additional implementation details are needed, including data types and other properties for the attributes.

    Explanation

    An entity model describes the data conceptually, but a database engine needs more specific column definitions.

  4. 4

    What is the first major step in implementing a data model as a database?

    Model answer

    Create a table for each entity in the data model.

    Explanation

    The entity-to-table translation provides the basic structure for implementing the model.

  5. 5

    What key must be specified for every database table?

    Model answer

    Every table must have a primary key.

    Explanation

    Specifying a primary key is one of the critical tasks in implementing each table.

  6. 6

    Which properties should be considered for each table column during implementation?

    Model answer

    Specify its data type, whether null values are allowed, any default value, and any constraints.

    Explanation

    These properties tell the database how to handle column values and help preserve data integrity.

  7. 7

    How can a column constraint help preserve data integrity?

    Model answer

    It can restrict values to an allowed range or to a predefined set of acceptable values.

    Explanation

    For example, a range constraint enforces minimum and maximum values, while a set constraint permits only listed values.

  8. 8

    Why might a designer revisit a table's structure after defining its columns?

    Model answer

    The designer may need to adjust the structure to meet normalization needs or to support justified denormalization for performance.

    Explanation

    Normalization review and performance decisions can lead to changes in the table design.

  9. 9

    What are modification anomalies, and what three types are identified?

    Model answer

    Modification anomalies are problems caused by changing data in a poorly structured table; they include insertion, update, and deletion anomalies.

    Explanation

    These problems arise when adding, modifying, or removing data produces unintended effects or inconsistencies.

  10. 10

    What is a deletion anomaly?

    Model answer

    It occurs when deleting one piece of information unintentionally removes other information that should be retained.

    Explanation

    Deleting a customer's row could also erase the only record that a particular type of car exists.

  11. 11

    How can a table that combines customer and car information produce an insertion anomaly?

    Model answer

    Adding a customer who owns no car may require missing values in the car-related columns.

    Explanation

    The customer cannot be recorded cleanly without also supplying information about a car.

  12. 12

    How can inconsistent spelling while adding a customer's car illustrate an insertion anomaly?

    Model answer

    Entering a car model already represented in the table with a misspelled name introduces inconsistent data during insertion.

    Explanation

    The same car information may then be stored in different forms in different rows.

  13. 13

    What is an update anomaly?

    Model answer

    It occurs when changing a fact requires updating multiple rows, and failing to update them all makes the data inconsistent.

    Explanation

    If multiple customers' rows contain the same car information, changing the car ID in only one row leaves conflicting values.

  14. 14

    How does normalization help prevent modification anomalies?

    Model answer

    It breaks a table containing multiple business concepts into smaller tables, reducing problematic repetition and dependencies.

    Explanation

    Separating customer and car information allows data about either concept to be added, changed, or deleted without unintentionally affecting the other.

  15. 15

    What is a functional dependency?

    Model answer

    It is a relationship in which the value of one attribute determines the value of another attribute or set of attributes.

    Explanation

    If one attribute's value lets you find another attribute's value, the latter is functionally dependent on the former.

  16. 16

    What is a determinant in a relation?

    Model answer

    A determinant is an attribute whose value can be used to determine the values of other attributes in the relation.

    Explanation

    The determinant is the attribute on which those other attributes depend.

  17. 17

    What is a candidate key?

    Model answer

    A candidate key is an attribute or set of attributes whose values determine every other non-key attribute in a row.

    Explanation

    Candidate keys identify rows through the values that determine the row's remaining non-key information.

  18. 18

    How do simple and composite candidate keys differ?

    Model answer

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

    Explanation

    A composite key's uniqueness comes from the combination of its component values.

  19. 19

    How are first, second, and third normal forms distinguished in the described normalization process?

    Model answer

    A relation is in first normal form by definition; removing partial dependencies gives second normal form, and removing transitive dependencies gives third normal form.

    Explanation

    Each step removes a further kind of dependency from the table.

  20. 20

    What condition defines Boyce-Codd Normal Form?

    Model answer

    A table is in Boyce-Codd Normal Form when every determinant is a candidate key.

    Explanation

    This condition is more stringent than third normal form and is sometimes called 3.5 normal form.

  21. 21

    At what level does the lecture consider a relation normalized, and why is that level generally useful?

    Model answer

    It considers a relation normalized when it is in Boyce-Codd Normal Form; a design in third normal form or above is generally not susceptible to the described modification anomalies and is usually sufficient for business data needs.

    Explanation

    Boyce-Codd Normal Form requires every determinant to be a candidate key, while third normal form or higher is described as generally adequate for database design.

  22. 22

    Which additional normal forms are named beyond Boyce-Codd Normal Form?

    Model answer

    Fourth Normal Form, Fifth Normal Form, DK Normal Form, and Sixth Normal Form are named.

    Explanation

    The lecture notes that additional normal forms have been identified beyond Boyce-Codd Normal Form.

  23. 23

    Why is a customer table containing customer, postal code, and accountant details not normalized in the example?

    Model answer

    Not all attributes depend only on the customer ID: postal code determines city and state, and accountant ID determines the accountant's name and phone number.

    Explanation

    These dependencies mean that some non-key information is determined by attributes other than the customer ID.

  24. 24

    How is the customer-and-accountant example decomposed into normalized tables?

    Model answer

    It is separated into Customer, Zip Code, and Accountant tables.

    Explanation

    Each table groups information around its determining identifier rather than keeping all details in the customer table.

  25. 25

    What are the keys and main attributes in the normalized customer example?

    Model answer

    Customer ID is the customer table's primary key, Zip is the zip code table's primary key, and Accountant ID is the accountant table's primary key. The customer table holds customer details and foreign keys; the other tables hold the city and state, and the accountant's name and phone, respectively.

    Explanation

    The customer table links to its related zip code and accountant records through foreign keys.

  26. 26

    What is denormalization, and what are two common reasons to use it?

    Model answer

    Denormalization combines two or more tables into one for a business reason; common motivations are simpler design and faster queries.

    Explanation

    It reverses some of the separation performed through normalization.

  27. 27

    How can combining customer and zip code data improve query performance?

    Model answer

    Storing city and state directly in the customer table can allow a customer's address to be retrieved without joining the zip code table.

    Explanation

    Avoiding a join can save the computational effort and time required to combine tables.

  28. 28

    Besides performance, what practical advantages can denormalizing the customer and zip code tables offer?

    Model answer

    It can make the design conceptually simpler, easier to maintain, and easier to use when writing SQL.

    Explanation

    The design contains fewer tables and no longer requires a zip code table join for the described address queries.

  29. 29

    What is the central trade-off of denormalization?

    Model answer

    It may improve query speed or simplicity, but it reintroduces the possibility of modification anomalies.

    Explanation

    Combining data can reduce joins while increasing repetition and the risk of inconsistent values.

  30. 30

    Why can storing city and state in every customer's row create a data-quality problem?

    Model answer

    It repeats the same information across many rows, creating more opportunities for inconsistent spelling, abbreviations, or capitalization.

    Explanation

    Different customers' rows may represent the same city and state in different ways.

  31. 31

    When should a database designer denormalize a design?

    Model answer

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

    Explanation

    The benefits should justify the increased risk of anomalies and inconsistent data.

  32. 32

    What measures can reduce the risks introduced by denormalization, and what cost do they carry?

    Model answer

    Database constraints and software validity checks can help prevent problems, but they add overhead tasks.

    Explanation

    These safeguards require extra implementation effort and may reduce the simplicity gains of denormalizing.

  33. 33

    In a one-to-one binary relationship where both sides are optional, where may the foreign key be placed?

    Model answer

    It can be placed in either table, based on which placement makes more conceptual sense.

    Explanation

    When both minimum cardinalities are zero, the lecture does not prefer one side for the foreign key.

  34. 34

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

    Model answer

    It should usually go in the table on the optional side of the relationship.

    Explanation

    The optional side has a minimum cardinality of zero, while the other side has a minimum cardinality of one.

  35. 35

    Why may an employee–locker relationship place its foreign key in either table?

    Model answer

    Both employees and lockers may participate optionally, so either table can hold the foreign key.

    Explanation

    The choice can depend on whether the designer finds it more natural to think of a locker as having an employee or an employee as having a locker.

  36. 36

    In the hospital patient–bed example, why is Bed ID stored as a foreign key in the Patient table?

    Model answer

    A patient must have exactly one bed, but a bed may be empty, so the bed side is optional and the foreign key belongs in the Patient table.

    Explanation

    The foreign key is placed on the optional side of the one-to-one relationship; here, the Patient table records the bed assigned to each patient.

  37. 37

    How does foreign-key placement determine how two tables are joined in a one-to-one relationship?

    Model answer

    The join matches the foreign key to the corresponding primary key, using the identifiers stored in whichever table holds the foreign key.

    Explanation

    For example, a Locker ID in Employee is matched to Locker ID in Locker; an Employee ID in Locker is matched to Employee ID in Employee.

  38. 38

    How is a one-to-many binary relationship represented using keys?

    Model answer

    The primary key from the one-side table is stored as a foreign key in the many-side table.

    Explanation

    The foreign key links each many-side row to its corresponding one-side row.

  39. 39

    In a one-to-many relationship, which table is called the parent and which is called the child?

    Model answer

    The one-side table is the parent, and the many-side table is the child.

    Explanation

    The child table contains the foreign key that references the parent.

  40. 40

    How is the team–player relationship implemented in the example?

    Model answer

    Team ID is the primary key of Team and is stored as a foreign key in Player, because a team can have many players and each player belongs to one team.

    Explanation

    Player is on the many side, so it receives the foreign key.

  41. 41

    Where can an SQL join for a one-to-many relationship be expressed?

    Model answer

    It can be written in the WHERE clause or expressed in the FROM clause using the JOIN keyword.

    Explanation

    Both approaches can join the related tables through their primary-key and foreign-key values.

  42. 42

    Why can a many-to-many relationship not be implemented directly between two tables in a relational database?

    Model answer

    It requires an intersection table between the two parent tables to represent the many-to-many associations.

    Explanation

    The intersection table records which rows from each parent table are related.

  43. 43

    How is a composite primary key typically formed in a many-to-many intersection table?

    Model answer

    It is formed from the primary keys of the two parent tables.

    Explanation

    The combined parent identifiers identify each association in the intersection table.

  44. 44

    What two roles do the parent identifiers serve in an intersection table with a composite primary key?

    Model answer

    Together they form the intersection table's primary key, and individually they serve as foreign keys to their parent tables.

    Explanation

    Each identifier participates in the composite key while also linking back to its own parent.

  45. 45

    How would a query listing students and all their classes use the Student, Class, and Student_Class tables?

    Model answer

    It joins Student to Student_Class by Student ID and Student_Class to Class by Class Number.

    Explanation

    The intersection table provides the links needed to assemble results from both parent tables.

  46. 46

    What is an associative entity, and what is an association relationship?

    Model answer

    An associative entity is an intersection table with additional non-key attributes; the relationship it represents is called an association relationship.

    Explanation

    The added attributes describe information about a particular association between the parent records.

  47. 47

    Why is Grade a suitable attribute for the Student_Class associative entity?

    Model answer

    Grade records a student's performance in a particular class, so it describes the association between that student and that class.

    Explanation

    The value applies to a specific student–class pairing rather than to the student or class alone.

  48. 48

    What restriction does a composite primary key impose on repeated associations in an associative entity?

    Model answer

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

    Explanation

    Because the pair forms the primary key, duplicating the same pair would violate the key's uniqueness.

  49. 49

    How does using a surrogate primary key change the possible repetition of parent-key pairs in an associative entity?

    Model answer

    The parent keys become ordinary foreign keys, so the same pair can appear multiple times unless another constraint prevents it.

    Explanation

    The surrogate key uniquely identifies rows without requiring each parent-key combination to be unique.

  50. 50

    In the product-rating example, what does a composite key allow or prevent compared with a surrogate key?

    Model answer

    A composite key of Customer ID and Product ID allows each customer to rate each product only once; a surrogate Rating ID can allow the same customer–product pair to appear multiple times.

    Explanation

    With a surrogate key, Customer ID and Product ID no longer jointly identify the rating row.

  51. 51

    What is a recursive relationship?

    Model answer

    It is a relationship in which a table is related to itself.

    Explanation

    The rows in the same table can be connected to other rows in that table.

  52. 52

    How are one-to-one and one-to-many recursive relationships implemented?

    Model answer

    A foreign key is added within the table to link its rows to other rows in the same table.

    Explanation

    The self-referencing foreign key creates the recursive relationship without another parent table.

  53. 53

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

    Model answer

    It is implemented using an intersection table that links rows in the table to other rows in that same table.

    Explanation

    The intersection table records the many-to-many connections between the same kind of entity.

  54. 54

    How can a one-to-one recursive sponsorship relationship be stored?

    Model answer

    A foreign key in the Person table can record either whom each person sponsored or who sponsored each person.

    Explanation

    Either representation can store the sponsorship information, depending on which is more conceptually natural.

  55. 55

    How are SQL queries written to retrieve data from a one-to-one recursive relationship?

    Model answer

    The same table is joined to itself, with a different alias for each instance.

    Explanation

    The aliases distinguish the two roles played by rows from the same table in the join.

  56. 56

    How does the customer referral example represent a one-to-many recursive relationship?

    Model answer

    A customer row stores a foreign key referring to the customer who referred it; one customer can refer many others, while each referred customer has at most one referrer.

    Explanation

    The self-referencing foreign key links referred customers to their referrer.

  57. 57

    How can a query find customers referred by customer number 100?

    Model answer

    Query the customer table twice using different aliases, then join the rows through the referrer foreign key and filter for customer 100 as the referrer.

    Explanation

    Using two aliases makes it possible to compare the referrer role with the referred-customer role in the same table.

  58. 58

    How would a doctor-treatment relationship be represented when each doctor may treat and be treated by many other doctors?

    Model answer

    Use an intersection table whose foreign-key columns refer to doctor rows, one for the treating doctor and one for the treated doctor.

    Explanation

    The intersection table resolves the many-to-many recursive relationship on the Doctor table.

  59. 59

    How does an SQL query retrieve pairs of doctors in a many-to-many recursive relationship?

    Model answer

    It selects from the Doctor table twice with different aliases and joins both instances to the doctor-intersection table.

    Explanation

    The aliases represent the two doctor roles, and the intersection table supplies the links between them.

1 of 59
Question 1 of 59

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent