17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8: Being Normal: Normalization and Other Basic Design Issues<br />

Tables<br />

This is going to seem beyond basic, but let’s briefly review what exactly a table is. We’re obviously not<br />

talking about the kind that sits in your kitchen, but, rather, the central object of any database.<br />

A table is a collection of instances of data that have the same general attributes. These instances of data are<br />

organized into rows and columns of data. A table should represent a “real-world” collection of data (often<br />

referred to as an entity), and will have relationships with information in other tables. A drawing of the various<br />

entities (tables) and relationships (how they work together) is usually referred to as an Entity-Relationship<br />

Diagram — or ER Diagram. Sometimes the term “ER Diagram” will even be shortened further down to ERD.<br />

By connecting two or more tables through their various relationships, you are able to temporarily create<br />

other tables as needed from the combination of the data in both tables (you’ve already seen this to some<br />

degree in Chapters 4 and 5). A collection of related entities are then grouped together into a database.<br />

Keeping Your Data “Nor mal”<br />

216<br />

Normalization is something of the cornerstone model of modern OLTP database design. Normalization<br />

first originated along with the concept of relational databases. Both came from the work of E. F. Codd<br />

(IBM) in 1969. Codd put forth the notion that a database “consists of a series of unordered tables that can<br />

be manipulated using non-procedural operations that return tables.”<br />

Several things are key about this:<br />

❑ Order must be unimportant.<br />

❑ The tables would be able to “relate” to each other in a non-procedural way (indeed, Codd called<br />

tables “relations”).<br />

❑ That, by relating these base tables, you would be able to create a virtual table to meet a new need.<br />

Normalization was a natural offshoot of the design of a database of “relations.”<br />

The concept of normalization has to be one of most over-referenced and yet misunderstood concepts in<br />

programming. Everyone thinks they understand it, and many do in at least its academic form. Unfortunately,<br />

it also tends to be one of those things that many database designers wear like a cross — it is<br />

somehow their symbol that they are “real” database architects. What it really is, however, is a symbol<br />

that they know what the normal forms are — and that’s all. Normalization is really just one piece of a<br />

larger database design picture. Sometimes you need to normalize your data — then again, sometimes<br />

you need to deliberately de-normalize your data. Even within the normalization process, there are often<br />

many ways to achieve what is technically a normalized database.<br />

My point in this latest soapbox diatribe is that normalization is a theory, and that’s all it is. Once you<br />

choose whether to implement a normalized strategy or not, what you have is a database — hopefully the<br />

best one you could possibly design. Don’t get stuck on what the books (including this one) say you’re<br />

supposed to do — do what’s right for the situation that you’re in. As the author of this book, all I can do<br />

is relate concepts to you — I can’t implement them for you, and neither can any other author (at least<br />

not with the written word). You need to pick and choose between these concepts in order to achieve the<br />

best fit and the best solution. Now, excuse me while I put that soapbox away, and we’ll get on to talking<br />

about the normal forms and what they purportedly do for us.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!