IT tutorials
 
Database
 

SQL Server 2012 : Normal Forms (part 2) - Second Normal Form

11/29/2013 2:04:06 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Second Normal Form (2NF)

The second normal form ensures that each attribute describes the entity. It's a dependency issue. Does the attribute depend on, or describe, the item identified by the primary key?

If the entity's primary key is a single value, this isn't too difficult. Composite primary keys can sometimes get into trouble with the second normal form if the attributes aren't dependent on every attribute in the primary key. If an attribute depends on one of the primary key attributes but not the other that is a partial dependency, which violates the second normal form.

For example, assume a database contains the table RegionalOfficeStore, whose primary key was a composite key including RegionalOfficeID and StoreID. Adding the regional phone number to the data model would violate the second normal form, as shown in Table 3. Because the primary key (PK) is a composite of both RegionalOffice and Store, and that the phone number is a permanent phone number for the regional office, a phone number isn't assigned for each store.

Table 3 Violating the Second Normal Form

PK-RegionalOffice PK-Store RegionalOffice PhoneNumber
Southeast Store One 828-555-1212
Southeast Store Two 828-555-1212
North Store Three 828-555-1213
North Store Four 828-555-1213
Northwest Store Five 828-555-1214
Northwest Store Six 828-555-1215

The problem with this design is that the phone number is an attribute of the regional office but not the store, so the PhoneNumber attribute is only partially dependent on the entity's primary key.

An obvious practical problem with this design is that updating the phone number requires either updating multiple tuples or risking having two phone numbers for the same phone.

The solution is to remove the partially dependent attribute from the entity with the composite keys, and create an entity with a unique primary key for the store as shown in Table 4. This new entity is then an appropriate location for the dependent attribute.

Table 4 Conforming to the Second Normal Form

c07tnt006

The PhoneNumber attribute is now fully dependent on the entity's primary key. Each phone number is stored in only one location, and no partial dependencies exist.

 
Others
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us