SQL interview questions and answers
SEE ALSO: How to Ace the Coding Interview
This document helps the reader prepare for SQL interview questions. It also includes the answers, with detailed explanations and source code.
What's included in the purchase
PDF file with the following:
- Refresher of SQL terminology, including sample SQL queries
- Answers to the following SQL interview questions
- Finding a row by using a simple equality
- Finding rows that contain a value as a part of a string
- Finding rows by using a comparison operator
- Finding rows that meet any of three conditions
- Finding rows that must meet several conditions
- Finding rows that are in a list of values
- Finding rows that have a value between two values
- Checking for NULL values
- Finding total sales and discounts for each product
- Calculate total revenue for each product
- Find the average price of each type of product and order results by average price
- For a specific product and category abbreviation, show the full category name using a CASE expression.
- Based on an item list price, show the price range for the item.
- Show special instructions if they exist for a customer.
- Sort a list of sales people by territory when they serve US. Otherwise, sort by country.
- Find the max hourly rate for each job title. Then restrict the result to those that are held by men with a max pay rate greater than $40 or women with a max pay rate greater than $42.
- Write an UPDATE statement to update vacation hours for salaried employees.
- What is a self join?
- How do you look customers in a DB using a text file?
- Discussion on IF-ELSE and WHILE
- Source code for all examples and questions
Length
14.5 pages
Difficulty
Advanced
About the author
The author has over 15 years of experience as architect and engineering director for several Fortune 500 companies. He loves programming interviews and writes frequently on the topic. Here are some additional details about the author:
- Expert in C#, .NET, ASP.NET, XML, XSLT, enterprise JAVA and client side technologies
- Extensive experience in C, C++, VB.Net, ASP, UML, Design Patterns and SEO
- Proficient in major databases including Microsoft SQL Server and Oracle
- In-depth knowledge of cloud providers including Amazon AWS and Microsoft Azure
- Clear understanding of all 3 major mobile platforms – iOS, Android and Windows Phone