Database Basics

The primary key of an order table (order_no, item_no, qty, cust_no, cust_name) is {order_no, item_no}, and its functional dependencies are {order_no, item_no} → qty, order_no → cust_no and cust_no → cust_name. Which is the correct result of normalizing this table up to third normal form (3NF)?

  1. Aorder_line(order_no, item_no, qty, cust_no), customer(cust_no, cust_name)
  2. Border_line(order_no, item_no, qty), order_header(order_no, cust_no), customer(cust_no, cust_name)
  3. Corder_line(order_no, item_no, qty), order_header(order_no, cust_no, cust_name)
Show answer and explanation

Answer: B. order_line(order_no, item_no, qty), order_header(order_no, cust_no), customer(cust_no, cust_name)

Second normal form is a state in first normal form in which no column depends on only part of the primary key (no partial functional dependency). order_no → cust_no is a partial functional dependency, because cust_no is determined by order_no alone, which is only part of the primary key, so the original table is in first normal form but not in second normal form. Moving the columns determined by order_no into order_header(order_no, cust_no, cust_name) gives second normal form. Third normal form (3NF) is a state in second normal form in which no column is determined via a column other than the primary key (no transitive functional dependency). order_header still has the transitive functional dependency order_no → cust_no → cust_name, so customer(cust_no, cust_name) is split off as well. The three tables order_line(order_no, item_no, qty), order_header(order_no, cust_no) and customer(cust_no, cust_name) are then in third normal form. Joining them on order_no and cust_no restores the original table.

  • A. order_line still contains cust_no, which is determined by order_no alone; this partial functional dependency means it is not even in second normal form.
  • B. Correct. Both the partial and the transitive functional dependencies have been removed, giving third normal form.
  • C. This is in second normal form, but order_header keeps the transitive functional dependency order_no → cust_no → cust_name.
Practice this topic Back to topic

Related calculators

Books on Database Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Database Basics questions

  1. The primary key of an employee table (emp_no, name, dept_code, dept_name) is emp_no, and every column holds a single value. The functional dependencies are emp_no → name, emp_no → dept_code and dept_code → dept_name. Which correctly states the normal form of this table?
  2. In a database used mainly for reading and aggregation, normalized tables are sometimes deliberately merged into one so that the same data is held in duplicate (denormalization). Which correctly pairs an advantage and a disadvantage of this design?
  3. In an E-R diagram, there is a many-to-many relationship between students and courses: one student takes several courses, and one course is taken by several students. Which is an appropriate way to implement this relationship with relational database tables?
  4. In an account table, a transaction is started, and an UPDATE that subtracts 300 from account A's balance and an UPDATE that adds 300 to account B's balance are executed. Then ROLLBACK is executed instead of COMMIT. What happens to the account table?
  5. Among the ACID properties a transaction should have, which is the property that a transfer debiting account A and crediting account B is either carried out completely or not at all, even if a failure occurs partway through?