Archive

Archive for the ‘SQL Interview Qs’ Category

ETL #73–NULL or NOT NULL and SQL Interview Questions

November 25, 2016 Leave a comment

Today is the day after Thanksgiving. There are many things to be thankful so I decided to write a short post today.

The first thing to be thankful is that Tomislav and I have completed the third edition of our MDX book, MDX with Microsoft SQL Server 2016 Analysis Services Cookbook. The book is published by Packt Publishing and has been uploaded to all the major publishing channels.  

Recommend SQL interview questions on deskbright.com

The second thing to be thankful is the enthusiastic audience who have been faithfully reading my posts. I recently received two inquires, which are somehow related. One reader was a bit confused by what I said about the SQL NULL values and what I said about being careful of what we put in the WHERE clause. Another reader is from Deskbright.com, a new online learning platform. Deskbright.com offers a number of free online resources to help people learn business skills — such as SQL. They are wondering if I’d be willing to post a link to their page on SQL interview questions (https://www.deskbright.com/sql/sql-interview-questions/) on my site.

As I am browsing through the SQL interview questions on deskbright.com, I see the #3 question, “Why is this query not returning the expected results?”, and thought this is perfect for the question from the reader I mentioned previously. Instead of overwhelming readers, deskbright.com listed only 7 most common SQL interview questions.

I’d rather not to repeat what they have and would recommend their SQL interview questions to those of you who are still new to SQL or Business Intelligence.

MDX Cook book third edition

The full title of the book is MDX with Microsoft SQL Server 2016 Analysis Services Cookbook. By the time you see this post, the book should be on Amazon, PacktPub.com, and all other online technology book stores and the e-subscription sites.

See also

ETL #72–Your data can mysteriously disappear after a WHERE clause was added (2)

ETL #71–Your data can mysteriously disappear after a WHERE clause was added (1)

SQL Interview Q #1 – What is First Normal Form (1NF)?

November 12, 2011 1 comment

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.

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+.

7. When creating PK for a table, we want accomplish two thins.
8. One is to eliminate duplicative columns from the same table.
9. 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).

Categories: SQL Interview Qs
%d bloggers like this: