Google Analytics Alternative

Search This Blog

Sunday, November 20, 2011

What is First Normal Form (1NF)?

My blog has many practical tips and best pratices for SQL/BI developers,but I haven’t focused on interview questions for SQL/BI developers so far. This might change in the future. It’s been a challenge for many people to break into or stay competitive in the SQL/BI profession.
I am very lucky to be able to stay in the profession and also stay in the financial industry. It’s been very rewarding for me to share my experience and knowledge through this blog.
Many recruiters do not understand what exactly a SQL/BI Developer does. One thing they assume we don’t do is design. On the contrary, designing from simple table structure to the entire sub-system for staging and ETL is our daily job.
In this blog, I’ll share with you one simple SQL design interview question and the answer that will set you apart from other candidates.
Interview question: what is First Normal Form (1NF)?
In order to give an answer that will earn you an A, we need to relate 1NF to what we do every day first. Memorising answers from hundrands of SQL blogs will not get you very far, because under the pressure of being interviewed by several people, your memory will start to suffer from impairment very soon.
Have you ever created primary keys for your SQL tables? I bet you have. But have you ever asked yourself why do we need to create primary keys? Or have you ever asked yourself a question in an even bigger scope: how do we efficiently organize data in a database?
Here are the simple answers to the above questions:
  1. Normalization is the process of efficiently organizing data in a database.
  2. There are two goals of the normalization process.
  3. One goal is to eliminate redundant data.
  4. Another goal is to ensure data dependencies make sense (only storing related data in a table).
  5. First normal form (1NF) happens to be the very basic rule for an organized database.
  6. The implementation of 1NF principle in DBMS is to create primary key for a SQL table.
  7. Now we know 1NF is implemented as primary key in DBMS. With the above answers, you’ve already received an A. With the additions below, you will for sure get a solid A+.
  8. When creating PK for a table, we want to accomplish two things.
  9. One is to eliminate duplicative columns from the same table.
  10. Another one is to create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).

No comments: