Database Normalization | Database Journal

Database Normalization

Written By
Ian Gilfillan
Ian Gilfillan
Mar 22, 2002
2 minute read


By now some of you are familiar with the basics of using
databases in your cgi scripts. Many of your
databases will be small, with one or two tables. But
as you become braver, tackling bigger projects, you may start
finding that the design of your tables is proving problematic.
The SQL you write starts to become unwieldy, and data anomalies
start to creep in. It is time to learn about database
normalization, or the optimization of tables.


Let’s begin by creating a sample set of data. Imagine we are
working on a system to keep track of employees working on certain
projects.













































Project numberProject nameEmployee numberEmployee nameRate categoryHourly rate
1023Madagascar travel site11Vincent RadebeA$60
  12Pauline JamesB$50
  16Charles RamorazC$40
1056Online estate agency11Vincent RadebeA$60
  17Monique WilliamsB$50


A problem with the above data should immediately be obvious.
Tables in relational databases, which would include most databases
you’ll work with, are in a simple grid, or table format. Here,
each project has a set of employees. So we couldn’t even enter
the data into this kind of table. And if we tried to use null
fields to cater for the fields that have no value, then we cannot
use the project number, or any other field, as a primary key (a
primary key is a field, or list of fields, that uniquely identify
one record). There is not much use in having a table if we can’t
uniquely identify each record in it.



So, our solution is to make sure that each field has no sets, or
repeating groups.
Now we can place the data in a table.

employee_project table













































Project numberProject nameEmployee numberEmployee nameRate categoryHourly rate
1023Madagascar travel site11Vincent RadebeA$60
1023Madagascar travel site12Pauline JamesB$50
1023Madagascar travel site16Charles RamorazC$40
1056Online estate agency11Vincent RadebeA$60
1056Online estate agency17Monique WilliamsB$50


Notice that the project number cannot be a primary key on it’s own.
It does not uniquely identify a row of data. So, our primary key
must be a combination of project number and employee number.
Together these two fields uniquely identify one row of data.
(Think about it. You would never add the same employee more than
once to a project. If for some reason this could occur, you’d
need to add something else to the key to make it unique).




Database Normalization: Part 2

Advertisement


 »


See All Articles by ColumnistIan Gilfillan


Ian Gilfillan

Ian Gilfillan lives in Cape Town, South Africa. He is the author of the book 'Mastering MySQL 4', published by Sybex, and has been working with MySQL since 1997. These days he develops mainly in PHP and MySQL, although confesses to starting out with BASIC and COBOL, way back when, and still has a soft spot for Perl. He developed South Africa's first online grocery store, and has developed and taught internet development and other technical courses for various institutions. He has majors in Programming and Information Systems, as well as English and Philosophy. For 5 years he was Lead Developer and IT Manager for Independent Online, South Africa's premier news portal. However, he has now 'retired' from fulltime work, and is hoping that his next book will be more in the style of William Blake and Allen Ginsberg.

Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.