Skip to content

Instantly share code, notes, and snippets.

@mutuadavid93
Created July 10, 2019 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutuadavid93/4244b7d3e3fd801b950fd1e5ce7e90d8 to your computer and use it in GitHub Desktop.
Save mutuadavid93/4244b7d3e3fd801b950fd1e5ce7e90d8 to your computer and use it in GitHub Desktop.
###################################
Normalization Reviewed
###################################
A. Ist Normal Form
==================
- Each cell to be Single Valued.
e.g. Spalding, Wilson should be on a the same cell.
solution: Separate them into individual records.
- Entries in a column are the same type.
hint: Remove those ain't the same proper type.
- Rows uniquely Identified.
solution: Add Unique ID, or More Columns to make unique.
e.g. a customer_id e.t.c
B. 2nd Normal Form
==================
- All attributes(Non-Key Columns) dependent on the key.
tip: Does CollumnA e.g. "Price" depend on the Key, e.g. "CustID"?
layman: Does the Price determine who buys an item?
if the answer is NO:
* Separate that Column to Create a Separate Entity together with related metadata.
* Make sure each Table passes 1st Normal Form as well.
* Make one of the columns a Primary Key.
Note: Be ware not to introduce a new column if isn't necessary(i.e. apply only if data repeats).
* Create a Junction Table where Possible with Each Entity's Primary Key to form a "Compoud Key".
Now the entities act as lookups.
Extra Tip: The rest of the columns should be generally associable with the Primary Key Chosen in 2NF.
C. 3rd Normal Form
==================
- All Fields (Columns) can be determined ONLY by the Key in the table and not other column.
tip: Move the columns with close relation into their own table.
Now relate the separated table to the table it was cut off from.
Make one of the columns in the new table a Primary Key and Have it from the Cut off table as a Foreign Key.
D. 4th Normal Form
==================
- No multi-valued dependencies.
That is:
Definition; One column can have different amount of values:
Forces you to wonder if you added a new record( or multiple items of that column type), They would force you
to start inputing a NULL value since you don't have matching quantity of the other item in the adjacent column.
tip: Move one of those columns out to form separate Table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment