All guides
Technical

SQL Questions Commonly Asked in Placements

Team prephasz· 15 Jul 2026· 1 min read

Joins, aggregation, the second-highest-salary question, and window functions — the SQL that shows up again and again in technical rounds.

SQL is one of the highest-return topics for placements: a small, well-defined syllabus that appears in almost every technical round. A weekend of focused practice pays off disproportionately.

Know cold

  • JoinsINNER, LEFT, RIGHT, FULL. Be able to explain each with a two-table example.
  • AggregationGROUP BY with HAVING, and why WHERE cannot filter aggregates.
  • Subqueries — correlated vs non-correlated.

The classics you will be asked

  1. Second-highest salary — via LIMIT/OFFSET, a subquery, or DENSE_RANK(). Know at least two ways.
  2. Nth-highest — generalise the above with a window function.
  3. Duplicate rows — find with GROUP BY … HAVING COUNT(*) > 1.
  4. Department-wise max — a join back to a grouped subquery.

Window functions

ROW_NUMBER(), RANK(), and DENSE_RANK() separate strong candidates from average ones. Understand how PARTITION BY resets the count. Write these queries by hand until the syntax is automatic — that is what the prephasz technical drills build.

Put this into practice

Drill these exact patterns with adaptive practice, timed mocks and company-wise assessments on prephasz.

Start practising free