Interview prep
SQL Interview Questions
SQL screens are near-universal for data and backend roles. Joins, window functions and query plans cover most of it.
Questions and answers
01Difference between INNER JOIN and LEFT JOIN?
INNER returns only matched rows; LEFT keeps every row from the left table and fills unmatched right-side columns with NULL. Filtering the right table in WHERE silently turns a LEFT JOIN back into an INNER JOIN.
02What is a window function?
An aggregate evaluated over a defined window of rows without collapsing them — ranking, running totals and period-over-period comparisons.
03How do indexes speed up queries, and when do they hurt?
They give sub-linear lookups on the indexed columns but add write cost and storage. Low-cardinality columns and heavily written tables are where they stop paying off.
04Explain the difference between WHERE and HAVING.
WHERE filters rows before aggregation; HAVING filters groups after aggregation.
05How do you find and fix a slow query?
Read EXPLAIN ANALYZE for the plan, look for sequential scans on large tables and bad row estimates, then add or fix indexes, rewrite correlated subqueries and update statistics.
How to answer these well
Interviewers are not grading recall — they are checking whether you've hit the failure mode the question describes. Anchor every answer to something you actually shipped or debugged with SQL.
Say the trade-off out loud. "I'd use X here, but it costs Y under Z conditions" scores higher than a clean textbook definition every time.
Roles asking for SQL
- Senior Data EngineerSoFi · Cottonwood Heights, Utah, United StatesonsiteseniorQuick applyPosted 1 hour ago
- Senior Analytics EngineerTwilio · Remote - US · RemoteremoteseniorQuick applyPosted 19 hours ago
- Staff Analytics EngineerCoinbase · Remote - USA · RemoteremotestaffQuick applyPosted 2 days ago
- Data EngineerAnthropic · San Francisco, CA | New York City, NY; Seattle, WAhybridmidQuick applyPosted 2 days ago
- Software Engineer, Data Engineering (X)xAI · Palo Alto, CAhybridmidQuick applyPosted 2 days ago
- Senior Software Engineer, Data EngineeringChime · San Francisco, CA, USAremoteseniorQuick applyPosted 2 days ago
- Human Data EngineerxAI · Palo Alto, CAonsitemidQuick applyPosted 2 days ago
- Sr. Analytics Engineer (X)xAI · Palo Alto, CAonsiteseniorQuick applyPosted 3 days ago
- Data EngineerPeraton · Fort Meade, MDonsitemidfull-time$135k – $216kPosted 4 days ago
- Data Engineer II, AWS Analytics EngineeringAmazon · Seattle, Washington, USAonsitemidPosted 4 days ago
Related prep
- Data Engineer jobs
- Data Engineer career guide
- Data Analyst jobs
- Data Analyst career guide
- Backend Engineer jobs
- Backend Engineer career guide
- Data Scientist jobs
- Data Scientist career guide
- Python interview questions
- Java interview questions
- JavaScript interview questions
- React interview questions
- AWS interview questions
- Azure interview questions
- Kubernetes interview questions
- Docker interview questions