SQL Interview Questions for Data Analysts
India 2026 — 30 Q&A from Beginner to Advanced
SQL is the #1 technical filter in Indian data analyst interviews. This guide covers every pattern tested at IT companies, startups, and MNCs — from basic SELECT to window functions, CTEs, and real sessionisation problems — with written answers and runnable SQL.
Basic SELECT, Filtering & Sorting
JOINs
GROUP BY, Aggregations & Subqueries
Window Functions
CTEs & Subqueries
Performance, NULL Handling & Real Scenarios
Frequently Asked Questions
What SQL topics are tested in data analyst interviews in India?
Indian data analyst interviews consistently test: JOINs (INNER, LEFT, RIGHT, FULL OUTER — often with tricky NULL behaviour), GROUP BY with HAVING, subqueries and CTEs, window functions (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, SUM OVER PARTITION BY), and practical business scenarios like "find the second highest salary", "find customers who ordered in both periods", or "find duplicate records". Window functions are the most commonly tested advanced topic at mid-level companies.
How should I prepare for the SQL round in an Indian data analyst interview?
Prepare by: (1) mastering all JOIN types and practising with NULL-heavy datasets where LEFT JOIN behaviour is non-obvious; (2) writing at least 20 GROUP BY + HAVING queries from scratch; (3) learning window functions — especially ROW_NUMBER() for deduplication and LAG/LEAD for period-over-period comparisons; (4) practising CTEs for multi-step problems; (5) solving real interview problems like "find top N per group", "running total", and "customers who never ordered". Most Indian SQL rounds are 2–4 practical questions in 30–45 minutes.
What is the difference between RANK and DENSE_RANK in SQL?
Both RANK() and DENSE_RANK() are window functions that assign a rank to each row within a partition. The difference is how they handle ties. RANK() leaves gaps after ties — if two rows tie for rank 2, the next rank is 4 (skipping 3). DENSE_RANK() does not leave gaps — if two rows tie for rank 2, the next rank is 3. Use DENSE_RANK() when you want continuous ranking without gaps, which is the common requirement for "find the Nth highest salary" problems.
Is SQL enough to get a data analyst job in India in 2026?
SQL is necessary but not sufficient. Strong SQL skill gets you past the technical screening round at most Indian companies, but you also need: Excel (for basic data work and business communication), Power BI or Tableau (for visualisation — Power BI dominates in India), and increasingly Python basics (for data cleaning at scale). SQL is the #1 technical filter — companies use it to eliminate candidates who cannot do the job — but Power BI is what you will actually use most often once hired.
EVIKA ACADEMY · NOIDA SECTOR 51 · SQL TRAINING + INTERVIEW PREP
Write SQL that clears the technical round
Live SQL training on real datasets. Mock interview rounds included. Free demo first.
Book Free Demo →