Search code examples
databasedatabase-normalization

What is data normalization?


Possible Duplicate:
What exactly does database normalization do?

Can someone please clarify data normalization? What are the different levels? When should I "de-normalize"? Can I over normalize? I have a table with millions of records, and I believe I over-normalized it, but I'm not sure.


Solution

  • If you have million columns you probably under-normalized it.
    What normalizing means is that

    every non-key attribute "must provide a fact about the key, the whole key, and nothing but the key."

    If you have a column that depends on anything but the key, you should normalize your table.
    see here.

    Added to reply to comment:
    If you have ProductID | ProductType | ProductTypeID, where ProdcutTypeID depends only on ProductType, you should make a new table for that:
    ProductID | ProductTypeID and on the other table: ProductTypeID | ProductTypeName .
    So to answer your question, pertaining to Product isn't accurate enough, in my example at the first case, I was pertaining to the Product as well. All columns should pertain only to ProductID (you may say you only describe product, but not describing anything else, even if it's related to product - that's accurate).
    Number of rows, generally speaking isn't relevent.