SQL interview practice: ten harder questions on a real database
SQL · Lesson 10
Ctrl/⌘ + Enter to run
✓
SQL Lesson 10 done.
Ten questions, and behind them six patterns worth being able to name out loud in an interview: a question about a customer's whole set of rows (EXISTS and NOT EXISTS), rows turned into columns with CASE inside an aggregate, a rate that needs every row of the base kept (LEFT JOIN, condition in ON), a sequence read one row ahead or one row back (LEAD, and the day-minus-row-number trick for streaks), a self join on a range, and a query that calls itself to walk a hierarchy. When a new question comes, the first job is to recognise which of these it is.
More SQL practice
SQL practice onlineSQL skills testSQL SELECT practiceSQL GROUP BY practiceSQL JOIN practice exercisesSQL subquery practicePrimary and foreign key practiceDatabase normalization practiceSQL constraints practiceSQL views practiceSQL window functions practiceSQL reference with queries you can runSQL errors, with a query to fixSQL interview questions, with answersSQL sample database for practiceExcel practice onlineLearn to read financial statements