Preview Content - log in or Buy Access Pass

SQL Interview Questions and Answers

Welcome to our Top 13 SQL Interview Questions and Answers page, we I start with basic questions, move on to intermediate level and finish on advanced questions.

NOTE: If you would like to focus on basic SQL interview questions only then we recommend visiting our Basic Interview Q&As page

Top 13 "mixed" questions

Questions are split into 3 levels:

  • For Freshers (Beginner Level),
  • For Experienced (Intermediate Level - 2 to 3 years of experience) and
  • Advanced (4 and 5 plus years of experience)

Questions For Freshers:

Question 1: What type of joins have you used? [answer]

Question 2: How can you combine two tables/views together? For instance one table contains 100 rows and the other one contains 200 rows, have exactly the same fields and you want to show a query with all data (300 rows). This sql interview question can get complicated. [answer]

Question 3: What is the difference between where and having clause? [answer]

Question 4: How would apply date range filter? [answer]

Question 5: What type of wildcards have you used? This is usually one of mandatory sql interview question. [answer]

Question 6: How do you find orphans? [answer]

Question 7: How would you solve the following sql queries using today's date: First day of previous month, First day of current month, Last day of previous month, Last day of current month? [answer]

Questions For Experienced:

Question 8You have a table that records website traffic. The table contains website name (multiple websites), page name, IP address and UTC date time. What would be the query to show all websites visited in the last 30 days with total number or visits, total number if unique page view and total number of unique visitors (using IP Address)? [answer]

Question 9: How to display top 5 employees with the higest number of sales (total) and display position as a field. Note that if both of employees have the same total sales values they should receive the same position, in other words Top 5 employees might return more than 5 employees. [answer]

Advanced Questions:

Question 10: How to get accurate age of an employee using SQL? [answer]

Question 11: This is SQL Server interview question. You have three fields ID, Date and Total. Your table contains multiple rows for the same day which is valid data however for reporting purpose you need to show only one row per day. The row with the highest ID per day should be returned the rest should be hidden from users (not returned). [answer]

Question 12: How to return truly random data from a table? Let say top 100 random rows? [answer]

Question 13: How to create recursive query in SQL Server? [answer]

Questions with answers

Questions For Freshers:

Question 1: What type of joins have you used? [all questions]

Answer: Joins knowledge is a MUST HAVE. This interview question is quite nice because most people have used inner join and (left/right) outer join which is rather mandatory knowledge but those more experienced will also mention cross join and self-join. In SQL Server you can also get full outer join. Join also strongly relate to understanding database concepts which are very important.

Question 2: How can you combine two tables/views together? For instance one table contains 100 rows and the other one contains 200 rows, have exactly the same fields and you want to show a query with all data (300 rows). This sql interview question can get complicated.[all questions]

To access members only content...
Log in (active member) or buy Access Pass
Learn as much as you like
Unlimited learning access pass*
* Secure one off payment, no re-occuring payments, no surprises
T-SQL SSIS SSRS 79 Mini Courses 529 Pages 287 Videos 314 Articles
Forum Live Webinars 12 Webinar Recordings DIY Projects Progress Tracking
New member joins every 8 hours
   

60 days, 100% money back guarantee
NO risks, NO questions asked, NO hard feelings

I can't speak highly enough of the quality MSBI materials industry practitioners with varying level of experience and exposure can benefit from this website. Their structured learning plan and courses, DIY projects, webinars and relevant resources go a very long way. I've gained a whole new perspective on delivering client BI projects to highest standards by employing best practices recommended on this website. Best quality MSBI training online suite I have used and least expensive too.

Franklin Demilade Osinowo

Best and affordable BI Training platform in the web. KEBI Academy doesn't provide training on BI rather their approach is to make you learn BI by yourself. Self Learning is always the best approach and I recommend KEBI Academy.

Jaiyaram Mahendran


You both are doing a great job by sharing your knowledge and experience, it helps many people who want to learn MSBI from the starting point and also for an experienced person to get to know more about MSBI. Thank you and keep sharing your MSBI knowledge and experience.

Shweta Patel

Great work on the videos. I have been enjoying them.

Patt Nelson


Did you find this page useful?
+8  |  -0
(8 Votes)