Strong Join-Protection Normal Form, Over-Strong Join-Protection Normal Form, and Domain Key
Normal Form. Each new level or form brings the database closer to being truly relational. The first three
forms were discussed. They provided enough normalization to meet the needs of most databases.
Going overboard with normalization can lead to an inefficient database and can make your schema too
complex with which to work. A proper balance of common sense and practicality can help you decide
when to normalize and when to let sleeping dogs lie.
Q&A
Q: When is the best time to normalize my database?
A:
Most of the time, normalization takes place after everything gets rolling and
your database is ready to move into production. This is not the best time to
do it. The best time to normalize is immediately after you have designed
your table and have it all diagrammed. That is when you will see some
problems and will be able to more readily recognize where normalization
needs to occur.
Q: Should I bring my database to 3NF?
A:
You should only if it makes sense to do so. As shown in today's last
example in the chapter, sometimes it makes sense not to normalize.
Normalization breaks things down to their smallest form—small equates to
speed. The faster a database performs, the better off you'll be.
Exercises
- Describe some of the benefits of normalization.
- Identify areas that may not need to be normalized.
Day 6: Adding Tables, Columns, and Indexes to Your
Database
Overview
Aside from creating the database, adding columns, tables, and indexes are the most important steps in the
database creation process. Tables and their columns are what define a database. Today you will learn the
following:
How to create tables and columns
How to edit existing columns
What an index is and how it is used
Creating Tables
Creating in MySQL is a relatively easy task. Like so many other things, there is more than one way to
perform this task. This chapter will cover two ways to add the tables you came up with in your design
session. First, you will use the MySQL monitor. The monitor is the primary tool to use when interacting with
your database. To create your first table, perform the following steps:
- Ensure that the mysqld daemon is running (using mysqladmin ping) and that you
are in the mysql directory. (pwd should return /usr/local/mysql, assuming you
installed mysql in the default directory.) - Start the MySQL monitor by typing the following:
- bin/mysql –u root –p Meet_A_Geek
You should be prompted for a password. After you enter your password, you will enter the MySQL
monitor with the Meet_A_Geek database as the active database (see Figure 6.1).