Data & SQL · INTERVIEW & OA PREP

Topic 8 of 12

SQL for Data Roles

For data analyst, data science, and many backend roles, a live SQL round is standard. Joins, aggregation, and window functions cover the vast majority of what's asked — practice writing them without autocomplete.

Key concepts

  • JOIN types: inner, left, right, full — and when each changes the result.
  • GROUP BY with HAVING to filter aggregates (vs WHERE for rows).
  • Window functions: ROW_NUMBER, RANK, running totals with OVER().
  • Subqueries and CTEs for readable multi-step logic.

Questions that get asked

  • Find the second-highest salary.
  • Count of employees per department, only where count > 5.
  • Nth highest value using a window function.
  • Find duplicate rows in a table.
  • Join orders to customers and show customers with no orders.
Tip

Say the query plan in words first ('join, then group, then filter') — it keeps complex queries from tangling.

Common mistake

Using WHERE to filter an aggregate. Aggregates are filtered with HAVING, after grouping.

Quick checks

Three tap-only questions to test your recall on this topic.

Keep going

Ready to apply? Browse live internships and sharpen your resume first.