Data Modeling Interview Questions and Answers

 

What is second normal form?

An entity is in the second normal form if all of its attributes depend on the whole (primary) key. In relational terms, every column in a table must be functionally dependent on the whole primary key of that table. Functional dependency indicates that a link exists between the values in two different columns.






If the value of an attribute depends on a column, the value of the attribute must change if the value in the column changes. The attribute is a function of the column. The following explanations make this more specific:






If the table has a one-column primary key, the attribute must depend on that key.




If the table has a composite primary key, the attribute must depend on the values in all its columns taken as a whole, not on one or some of them.




If the attribute also depends on other columns, they must be columns of a candidate key; that is, columns that are unique in every row.




If you do not convert your model to the second normal form, you risk data redundancy and difficulty in changing data. To convert first-normal-form tables to second-normal-form tables, remove columns that are not dependent on the primary key.

Posted by:Richards