Study packs for SQL
Questions, notes and solved practice sets, written once and checked by running every query. Download the PDF and study anywhere, even offline.
Payments are opening soon. You can already read the free sample below. The Buy buttons switch on when checkout goes live.
Not a wall of text. Every answer comes with the query, the real output and the reason.
Q: How do you find the second highest salary?
SELECT MAX(salary) AS second_highest
FROM employees
WHERE salary < (SELECT MAX(salary)
FROM employees);
second_highest
--------------
95000
The maximum of everything below the maximum. It copes with ties at the top.
C14. Customers who never ordered [Medium]
SELECT c.name FROM customers c WHERE NOT EXISTS ( SELECT 1 FROM orders o WHERE o.cust_id = c.cust_id); name ---- Lata
NOT EXISTS stays correct even when the subquery column can be NULL, unlike NOT IN.
PDF, A4, readable on phone, tablet and laptop. No account or app needed.
Standard SQL that runs on MySQL 8, PostgreSQL and SQLite. MySQL-only functions such as YEAR() are marked, and Class 12 board points are called out in the notes.
Every query in the practice sets and the query answers in the interview bank were run on a real SQL engine against the sample database printed in the book, and the output you see is the output it produced.
Yes: ten interview questions, the Joins chapter and three solved practice questions. Use the Free sample button on any product.
The files are for your own study. Please do not share or resell them. Friends can grab the free sample and the free app.
Tell us through the issues page and we will fix it or make it right.