
SQL for Data Analysts — What Level Do You Actually Need to Get Hired?
To get your first data analyst job in India, you need intermediate SQL: SELECT, WHERE, GROUP BY, HAVING, all JOIN types, subqueries, and window functions (ROW_NUMBER, RANK, LAG, LEAD). Basic SQL alone is not enough. Advanced SQL (query optimisation, indexing, stored procedures) is not required for most fresher roles. The key benchmark: you should be able to solve HackerRank SQL Medium problems and LeetCode Database Medium problems before applying.
SQL Levels for Data Analysts — What Each Level Gets You
| SQL Level | What You Know | Job Outcome |
|---|---|---|
| Beginner | SELECT, FROM, WHERE, ORDER BY, LIMIT, basic aggregations | Not hireable as a data analyst. Internship-level only. |
| Intermediate ✅ | All JOINs, GROUP BY, HAVING, subqueries, CTEs, window functions, CASE, date/string functions | Hireable at ₹4–7 LPA fresher DA roles. This is the target level. |
| Advanced | Query optimisation, EXPLAIN plans, indexing strategy, stored procedures, triggers, partitioning | Unlocks senior DA, data engineer, and analytics engineering roles (₹12–20 LPA+). |
Exactly What SQL Topics to Learn (In Order)
Phase 1 — Core Querying (Weeks 1–2)
- SELECT, FROM, WHERE — filtering rows with conditions
- ORDER BY, LIMIT/OFFSET — sorting and pagination
- Aggregations: COUNT, SUM, AVG, MIN, MAX
- GROUP BY and HAVING — aggregating by category, filtering groups
- DISTINCT — removing duplicates
- NULL handling: IS NULL, IS NOT NULL, COALESCE, IFNULL
Phase 2 — Joins and Relationships (Weeks 3–4)
- INNER JOIN — rows that match in both tables
- LEFT JOIN — all rows from the left table, matched rows from right
- RIGHT JOIN — all rows from the right table
- FULL OUTER JOIN — all rows from both tables
- Self JOIN — joining a table to itself (for hierarchy/manager-employee queries)
- CROSS JOIN — every row from table A × every row from table B
- Multi-table joins — joining 3+ tables in a single query
Phase 3 — Intermediate SQL (Weeks 5–6)
- Subqueries — nested SELECT inside WHERE, FROM, and SELECT clauses
- CTEs (Common Table Expressions) — WITH clause for readable multi-step queries
- CASE statements — conditional logic inside queries (if-else in SQL)
- Date functions: DATEPART, DATEDIFF, DATE_FORMAT, YEAR(), MONTH(), DATE_ADD
- String functions: CONCAT, SUBSTRING, UPPER, LOWER, TRIM, REPLACE, LIKE, REGEXP
- UNION and UNION ALL — combining result sets from multiple queries
Phase 4 — Window Functions (Weeks 7–8) — Most Asked in Interviews
- ROW_NUMBER() — assign a unique row number within a partition
- RANK() and DENSE_RANK() — rank rows, with/without gaps for ties
- LAG() and LEAD() — access previous/next row values (month-over-month changes)
- SUM() OVER, AVG() OVER — running totals and moving averages
- PARTITION BY — restart the window calculation per group
- NTILE() — divide results into N equal buckets (quartiles, deciles)
The 10 SQL Questions Asked Most in Indian DA Interviews
Based on interview reports from GrowAI students placed at Indian companies in 2025–2026, these are the most common SQL question types:
- Find the Nth highest salary — tests window functions (DENSE_RANK) or subqueries
- Find duplicate records — GROUP BY + HAVING COUNT(*) > 1
- Month-over-month revenue change — LAG() window function
- Customers who bought in Month 1 but not Month 2 — LEFT JOIN or NOT IN with subquery
- Running total of sales — SUM() OVER (ORDER BY date)
- Top 3 products per category — ROW_NUMBER() with PARTITION BY
- Users active for 3 consecutive days — self-join or LAG() with date arithmetic
- Cohort retention analysis — date functions + GROUP BY + LEFT JOIN
- Missing dates in a sequence — date series generation or recursive CTE
- Department with the highest average salary — JOIN + GROUP BY + ORDER BY + LIMIT
If you can answer all 10 above in under 10 minutes each, you are interview-ready for 90% of Indian data analyst roles.
Where to Practice SQL for Free
| Platform | Best For | Difficulty |
|---|---|---|
| LeetCode (Database) | Interview simulation — real company questions | Easy → Hard |
| HackerRank SQL | Structured practice by topic (Basic → Advanced) | Easy → Advanced |
| Mode Analytics SQL Tutorial | Learning + practice in browser, no setup | Beginner → Intermediate |
| SQLZoo | Interactive tutorial with instant feedback | Beginner → Intermediate |
| StrataScratch | Real interview questions from specific companies | Intermediate → Hard |
| DataLemur | SQL + data science interview prep, well-explained | Easy → Hard |
Common SQL Mistakes That Fail DA Interviews
- Using subqueries when a window function is cleaner — interviewers prefer window functions for ranking/running total problems
- Forgetting HAVING vs WHERE — WHERE filters rows before aggregation, HAVING filters after. Classic mistake.
- Writing slow queries without thinking about performance — at senior level, mention indexes and avoid SELECT *
- Not testing for NULLs — many real datasets have NULLs; forgetting to handle them gives wrong answers
- Confusing RANK() and DENSE_RANK() — RANK() skips numbers after ties, DENSE_RANK() doesn’t. Know the difference.
- Not reading the question carefully — “top 3 per category” is different from “top 3 overall”. Slow down before writing.
SQL for Different Types of Data Analyst Roles
| Role | SQL Depth Required | Notes |
|---|---|---|
| MIS Analyst / Reporting Analyst | Basic to Intermediate | Heavy on SELECT, GROUP BY, JOINS. Less window functions. |
| Business Intelligence Analyst | Intermediate | SQL + Power BI/Tableau. CTEs and window functions frequently used. |
| Product Analyst | Intermediate to Advanced | Complex funnel queries, cohort analysis, A/B test queries. BigQuery/Snowflake. |
| Marketing Analyst | Basic to Intermediate | Campaign performance queries, UTM tracking. Excel sometimes replaces SQL. |
| Financial / BFSI Analyst | Intermediate | Date functions, running totals, period-over-period comparisons essential. |
| Analytics Engineer | Advanced | dbt, data modelling, performance tuning. Not a fresher role. |
The honest benchmark: solve 50 LeetCode Database problems (Easy + Medium) before you apply for your first DA job. That’s it. You don’t need Hard problems for most fresher roles in India.
Want to practise SQL with real mentorship and interview feedback? Talk to a GrowAI mentor →
Frequently Asked Questions
What SQL level is required for a data analyst job?
Intermediate SQL is the minimum: all JOIN types, GROUP BY, HAVING, subqueries, CTEs, and window functions (ROW_NUMBER, RANK, LAG, LEAD). Basic SQL alone is not enough. Advanced SQL is not required for fresher roles.
Do data analysts need to write complex SQL?
Yes, but “complex” means window functions and multi-table joins — not database administration. A data analyst is not expected to optimise database indexes or write stored procedures at fresher level.
Is SQL enough to get a data analyst job?
SQL alone is rarely enough in 2026. Most Indian DA job descriptions require SQL + one BI tool (Power BI or Tableau) + Excel. Python is increasingly required at product companies.
How long does it take to learn SQL for data analytics?
Basic SQL: 1–2 weeks. Interview-ready intermediate SQL: 6–8 weeks with daily practice solving problems on LeetCode or HackerRank.
