SQL Learning Plan

How to Learn SQL in 30 Days for Data Analyst Interviews — Day-by-Day Plan
HomeData Analyst › SQL Learning Plan
📊 Data Analyst

How to Learn SQL in 30 Days for Data Analyst Interviews — Day-by-Day Plan

By Prakhar Shrivastava·April 24, 2026·8 min read·1,300+ words
Quick Answer
30 days is enough to learn SQL from zero to interview-ready with 1–2 hours of daily practice. Days 1–10: basics. Days 11–20: JOINs and advanced queries. Days 21–30: window functions and real interview questions. Use a live SQL compiler from day one — practice beats reading every time.

SQL is the #1 required skill for data analyst interviews in India — tested in 95% of roles at every company from TCS to Google. The good news: SQL is also one of the fastest technical skills to go from zero to interview-ready. With 1–2 hours of daily focused practice, 30 days is genuinely enough.

This guide gives you a complete day-by-day plan — not vague topics, but exact things to do each day — plus free resources to practice in a live SQL compiler starting from day one.

💡
GEO Block — What is SQL?SQL (Structured Query Language) is a programming language used to query and manage relational databases. A data analyst uses SQL to extract, filter, aggregate and transform data stored in tables. Example: SELECT product, SUM(revenue) FROM sales GROUP BY product gives total revenue per product.

The 30-Day SQL Learning Plan

DaysTopicWhat to MasterPractice Goal
Days 1–3SELECT BasicsSELECT, WHERE, ORDER BY, LIMIT, DISTINCT, aliasesWrite 10 basic SELECT queries without help
Days 4–6AggregationsCOUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVINGSolve 10 GROUP BY questions, explain WHERE vs HAVING
Days 7–10SQL JOINsINNER, LEFT, RIGHT, FULL OUTER, anti-join patternWrite all 4 JOIN types + find records with no match
Days 11–14Subqueries & CTEsSubquery in WHERE/FROM, WITH clause, CTE chainingRewrite 3 nested subqueries as CTEs
Days 15–20Window FunctionsRANK, DENSE_RANK, ROW_NUMBER, LAG, LEAD, SUM OVERSolve top-N-per-group, month-over-month growth
Days 21–24Date & String FunctionsDATEDIFF, EXTRACT, SUBSTR, CONCAT, COALESCEWrite 5 date-based queries from real interview banks
Days 25–28Real Interview Questions50+ company-specific questions from Google, Amazon, FlipkartTimed practice: 30 min per question, no hints
Days 29–30Mock + ReviewFull mock SQL interview session + gap reviewComplete 1 full mock interview, identify weak areas

Days 1–10: SQL Foundations

The foundation block covers everything needed to answer “easy” SQL interview questions. These topics are asked in 100% of data analyst interviews — getting them solid is non-negotiable.

Days 1–3: SELECT and Filtering

SQL — Day 1 Practice
— Run these in order. Each builds on the previous.
— 1. Get all columns from orders
SELECT * FROM orders;
— 2. Get only what you need
SELECT order_id, customer_name, order_amount FROM orders;
— 3. Filter: orders over ₹5,000
SELECT * FROM orders WHERE order_amount > 5000;
— 4. Sort by highest amount first
SELECT * FROM orders ORDER BY order_amount DESC LIMIT 10;
— 5. Unique cities in customer table
SELECT DISTINCT city FROM customers ORDER BY city;
Day 1 GoalBy end of Day 3, you should write any SELECT query with WHERE, ORDER BY and LIMIT without looking at syntax. Practice in our live SQL compiler → — it has pre-loaded tables so you start immediately.

Days 4–6: GROUP BY and Aggregations

GROUP BY is the most commonly tested SQL concept in entry-level interviews. The single most important thing to understand: every column in SELECT must either be in GROUP BY or be an aggregate function.

SQL — Days 4–6 Practice
— Revenue and orders per category
SELECT
category,
COUNT(*) AS total_orders,
SUM(order_amount) AS revenue,
ROUND(AVG(order_amount), 0) AS avg_order
FROM orders
GROUP BY category
ORDER BY revenue DESC;
— HAVING: categories with revenue over ₹1 lakh
SELECT category, SUM(order_amount) AS revenue
FROM orders
GROUP BY category
HAVING SUM(order_amount) > 100000;

Days 7–10: All JOIN Types

JOINs are tested in 89% of analyst interviews. The most important pattern to master is the anti-join — finding records in one table that have no match in another. This is asked constantly: “customers who never ordered”, “products never purchased”, “users with no logins last 30 days”.

SQL — Anti-Join (Most Tested)
— Customers who have NEVER placed an order
— LEFT JOIN + WHERE right side IS NULL = anti-join
SELECT c.customer_name, c.city
FROM customers c
LEFT JOIN orders o ON c.id = o.customer_id
WHERE o.order_id IS NULL;
— Pattern: LEFT JOIN the “child” table
— Filter WHERE child.id IS NULL
— = “parents with no children”

Days 11–20: Advanced SQL

Days 11–14: CTEs — Write Cleaner SQL

CTEs (Common Table Expressions) use the WITH keyword to name a subquery. They make complex SQL dramatically more readable and are strongly preferred over nested subqueries in interviews.

SQL — CTE Pattern
— Step 1: aggregate per customer
WITH customer_totals AS (
SELECT customer_id, SUM(amount) AS total
FROM orders GROUP BY customer_id
),
— Step 2: rank within city
ranked AS (
SELECT ct.*, c.city,
RANK() OVER(PARTITION BY c.city ORDER BY ct.total DESC) rn
FROM customer_totals ct JOIN customers c ON ct.customer_id=c.id
)
— Step 3: get top 1 per city
SELECT * FROM ranked WHERE rn = 1;

Days 15–20: Window Functions — The Game Changer

Window functions are tested in 92% of senior data analyst interviews. If you can write window function queries fluently, you immediately stand out from 80% of candidates. Dedicate 6 full days here — it’s worth it.

FunctionWhat it doesClassic Interview Question
RANK()Rank with gaps on tiesTop-N employees per department
ROW_NUMBER()Always unique rankExactly 1 record per group
DENSE_RANK()Rank without gaps2nd highest salary (no gaps)
LAG(col, n)Value from N rows beforeMonth-over-month growth %
LEAD(col, n)Value from N rows aheadDays until next purchase
SUM() OVER()Running/cumulative totalCumulative revenue by date

Days 21–30: Interview Practice

The final 10 days are about performance, not learning. You should no longer be learning new concepts — you should be practising speed, accuracy and thinking out loud.

1

Days 21–24: Timed question practice

Pick 2–3 questions daily from the 50+ question bank at dataanalystinterview.com/sql-top-question/. Set a 25-minute timer per question. If you get stuck after 10 minutes, look at the hint — not the full answer.

2

Days 25–26: Company-specific prep

Research your target company. If it’s Flipkart, focus on window functions and business case queries. If it’s TCS or Infosys, easy-to-medium GROUP BY questions are the focus. Tailor your practice.

3

Days 27–28: Weak area drilling

From your 20+ days of practice, you know what trips you up. Spend 2 full days on only your weak spots. Most people need extra time on CTEs or consecutive-day window function tricks.

4

Days 29–30: Full mock interview

Book a mock SQL interview session. Write queries live, explain your reasoning out loud, handle feedback. The difference between practising alone and performing in an interview is massive.

⚠️
The Most Important RuleDon’t just read SQL — write it. Every single day, open a SQL compiler and type queries. Your fingers need to know the syntax as well as your brain. Reading is 20% as effective as writing. Use our free live compiler →

⭐ Key Takeaways

  • 30 days is enough with 1–2 hours daily — basics in week 1, advanced in weeks 2–3, practice in week 4
  • Days 1–10 cover 100% of easy interview questions — GROUP BY, JOINs and basic aggregations
  • Days 15–20 on window functions is your biggest differentiator — 92% of senior interviews test these
  • The anti-join pattern (LEFT JOIN + WHERE IS NULL) is asked at almost every company — memorise it
  • Days 29–30: do a live mock interview — writing SQL under observation reveals habits reading cannot
  • All resources needed are free: SQL Hub with live compiler at dataanalystinterview.com/sql-interview/
❓ Frequently Asked Questions
Can I learn SQL in 30 days for a data analyst interview?
+
Yes — 30 days is enough to learn SQL from scratch to an interview-ready level if you practise 1–2 hours daily. Days 1–10 cover basics (SELECT, WHERE, GROUP BY, JOINs). Days 11–20 cover advanced topics (window functions, CTEs). Days 21–30 are focused interview practice with real company questions.
What SQL topics are asked in data analyst interviews in India?
+
The most tested SQL topics in Indian data analyst interviews: GROUP BY with aggregations (COUNT, SUM, AVG), all JOIN types especially LEFT JOIN and anti-join pattern, window functions (RANK, ROW_NUMBER, LAG, LEAD) — tested in 92% of senior interviews, CTEs for readable complex queries, and subqueries. Start with basics and reach window functions within 4 weeks.
What is the best free resource to learn SQL for data analyst interviews?
+
The best free resources for SQL interview prep: Our SQL Interview Hub at dataanalystinterview.com/sql-interview/ has all 8 topics with a live SQL compiler you can practice in your browser. W3Schools for syntax reference. LeetCode and HackerRank for timed SQL practice. SQLZoo for interactive exercises. Our live compiler pre-loads real tables so you can practice JOINs and window functions immediately.
How many SQL questions should I practice before an interview?
+
Aim for 50+ SQL questions before any data analyst interview. Solve 20 easy questions to build confidence, 20 medium questions covering JOINs and GROUP BY with HAVING, and 10+ hard questions focusing on window functions and CTEs. Our SQL Hub has 50+ categorised real company questions with full answers — free at dataanalystinterview.com/sql-top-question/

Start Day 1 right now — free

Our SQL Hub has all 8 topics, worked examples and a live SQL compiler with pre-loaded tables. No account, no download.

Start SQL Learning Free →
PS
Prakhar Shrivastava
Founder · 10+ years in analytics · 800+ candidates mentored
Former analytics lead at top product companies. Helping India’s data analysts crack interviews through structured, practical preparation.

Leave a Reply

Discover more from Interview Preperation

Subscribe now to keep reading and get access to the full archive.

Continue reading