My web server - What s So Normal About These Forms? Remember we
What s So Normal About These Forms? Remember we told you to call the first table zero ? That s called Zero Form. It is basically the raw data, and is usually a very flat structure, with lots of repeated data. You see data like this sometimes when a small company keeps records of its customers in a spreadsheet. The first pass through the table, which you called pass one, was the first step of normalization, called First Normal Form, or 1NF. This step requires that you eliminate all repeating data in columns (which you did with the power column), create separate rows for each group of related data, and identify each record with a primary key. The first step satisfies the requirements of 1NF. You can see where we re going with this, can t you? The Second Normal Form (2NF) requirements state that you must place subsets of data in multiple rows in separate tables. You did that by separating the power data into its own table. Second Normal Form also requires that you create a relationship with the original table by creating a foreign key. You did that in pass two, when you satisfied the requirements for 2NF. On your third pass, you removed all the columns not directly related to the primary key (city and state), and used the ZIP code as the foreign key to the new city_state table. Third Normal Form (3NF) is then satisfied. Congratulations! You normalized a database just like the pros do. There are further requirements for database normalization, but Third Normal Form is generally accepted as being good enough for most business applications. The next step is Boyce-Codd Normal Form, followed by Fourth Normal Form and Fifth Normal Form. In this case, the other Forms don t apply the database is as normalized as it needs to get. All tables are easily modifiable and updateable, without affecting data in the other tables. We know there are some database gurus out there who would tell you that in order to completely satisfy the Forms of normalization, that the align column should be put into its own table and linked with a foreign key. While that may be true in the strictest sense of the rules, we usually think of normalization as a guideline. In this case, we have only two values, good and evil. Those values will never change, and they will be the only values available to the user. Because of this, we can actually create a column with the ENUM datatype. Because the values good and evil will be hardcoded into the table definition, and we don t ever see a need to change the values in the future, there is no problem with keeping those values in the char_main table. Standardization When you are designing a new application, it is a very good idea to come up with standards, or design rules, that you adhere to in all cases. These can be extensive, such as the standards published by the W3C for HTML, XML, and other languages. They can be very short, but very strict, such as the list of 10 standards brought down from a mountain by an old bearded man. For now you ll just standardize your table structure. For this application, we came up with the following table standards: . Table names: Table names should be descriptive, but relatively short. Table names will be in lowercase. They should describe what main function they serve, and what application they belong to. All six tables should start with char_ to show that they belong to the character application. 283 Building Databases
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.