Practice SQL Interview questions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There’s no better way to hone your SQL skills than to practice. The following questions are meant to help you do that. It’s recommended that you try finding the answers on your own before reading the given answer. They are based on the tables presented below.
Given the tables above, find the following:
Subscribe to our newsletter on the left to receive more free interview questions! Let’s start by answering part a. It’s obvious that we would need to do a join, because the data in one table will not suffice to answer this question. Now, what tables should we use for the join? We know that the customer ID of Samsonic is 4, so we can use that information and do a simple join with the salesperson and customer tables. The SQL would look like this:
We can also use subqueries (a query within a query) to come up with another possible answer. Here is an alternative, but less efficient, solution using a subquery:
Click next to check out the answer to parts B and C. |
Subscribe to our newsletter for more free interview questions.
Follow @programmerintvwVaroon Sahgal, Author of ProgrammerInterviewon

