Click here to Skip to main content
15,879,474 members
Articles / Database Development

Get Ready to Learn SQL: 9. Database First Normal Form Explained in Simple English

Rate me:
Please Sign up or sign in to vote.
4.88/5 (6 votes)
21 Oct 2014MIT3 min read 12.7K   9  
Database First Normal Form explained in simple English

This is the second in a series of posts teaching normalization.

The first post introduced database normalization, its importance, and the types of issues it solves.

In this article, we’ll explore the first normal form. For the examples, we’ll use the Sales Staff Information shown below as a starting point. As we pointed out in the last post’s modification anomalies section, there are several issues to keeping the information in this form. By normalizing the data you see, we’ll eliminate duplicate data as well as modification anomalies.

Image 1

1NF – First Normal Form Definition

The first steps to making a proper SQL table is to ensure the information is in first normal form. Once a table is in first normal form, it is easier to search, filter, and sort the information. The rules to satisfy 1st normal form are:

  • That the data is in a database table. The table stores information in rows and columns where one or more columns, called the primary key, uniquely identify each row.
  • Each column contains atomic values, and there are no repeating groups of columns.

Tables in first normal form cannot contain sub columns. That is, if you are listing several cities, you cannot list them in one column and separate them with a semi-colon. When a value is atomic, the values cannot be further subdivided. For example, the value “Chicago” is atomic; whereas “Chicago; Los Angeles; New York” is not. Related to this requirement is the concept that a table should not contain repeating groups of columns such as Customer1Name, Customer2Name, and Customer3Name.

Image 2

Our example table is transformed to first normal form by placing the repeating customer related columns into their own table. This is shown below:

Image 3

The repeating groups of columns now become separate rows in the Customer table linked by the EmployeeID foreign key. As mentioned in the lesson on Data Modeling, a foreign key is a value which matches back to another table’s primary key. In this case, the customer table contains the corresponding EmployeeID for the SalesStaffInformation row. Here is our data in first normal form.

Image 4

This design is superior to our original table in several ways:

  1. The original design limited each SalesStaffInformation entry to three customers. In the new design, the number of customers associated with each design is practically unlimited.
  2. It was nearly impossible to Sort the original data by Customer. You could, if you used the UNION statement, but it would be cumbersome. Now, it is simple to sort customers.
  3. The same holds true for filtering on the customer table. It is much easier to filter on one customer name related column than three.
  4. The insert and deletion anomalies for Customer have been eliminated. You can delete all the customers for a SalesPerson without having to delete the entire SalesStaffInformation row.

Modification anomalies remain in both tables, but these are fixed once we reorganize them as 2nd normal form. More tutorials are to follow! Remember! I want to remind you all that if you have other questions you want answered, then post a comment or tweet me. I’m here to help you. What other topics would you like to know more about?

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Easy Computer Academy, LLC
United States United States
Hello my name is Kris. I’m here because I am passionate about helping non-techie people to overcome their fear of learning SQL.

I know what it is like to not know where to start or whether the time spent learning is worth the effort. That is why I am here to help you to:
- Get started in an easy to follow step-by-step manner.
- Use your time wisely so you focus on what is important to learn to get the most value from your time.
- Answer your questions. Really! Just post a comment and I’ll respond. I’m here to help.

It wasn’t long ago that I was helping a colleague with some reporting. She didn’t know where to start and soon got overwhelmed and lost as she didn’t know SQL.

I felt really bad, as she was under pressure to get some summary information to her boss, the built-in reports were falling short, and to make them better would require her to know SQL. At that time that seemed impossible! It in dawned on me, it doesn’t have to be that way.

Then I discovered a way for anyone with the desire to easily learn SQL. I worked with my co-worker, started to teach her what I learned and soon she was able to write reports and answer her boss’ questions without getting stressed or ploughing hours into manipulating data in Excel.

It hasn’t always been easy. Sometimes the information seems abstract or too conceptual. In this case I’ve found out that a visual explanation is best. I really like to use diagrams or videos to explain hard-to-grasp ideas.

Having video, pictures, and text really help to reinforce the point and enable learning.

And now I want to help you get the same results.

The first step is simple, click here http://www.essentialsql.com/get-started-with-sql-server/

Comments and Discussions

 
-- There are no messages in this forum --