SQL Learning Plan: A Suggested 30-Day Schedule

Home β€Ί Data Analyst β€Ί SQL Learning Plan
πŸ“Š Data Analyst

How to Learn SQL in 30 Days for Data Analyst Interviews β€” Day-by-Day Plan

In brief: Follow a suggested SQL study schedule covering fundamentals, joins and analytical queries. Adjust the pace and use completed exercises to assess your understanding.
By Prakhar ShrivastavaΒ·April 24, 2026Β·8 min readΒ·1,300+ words
Quick Answer
Use 30 days as a suggested schedule to learn SQL for practising SQL fundamentals at a pace you can sustain. Days 1–10: basics. Days 11–20: JOINs and advanced queries. Days 21–30: window functions and interview-style practice questions. Use a live SQL compiler from day one β€” practice beats reading every time.

SQL is useful for querying relational data. This plan introduces its core concepts and gives you a structure for daily practice.

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–28Interview Practice QuestionsInterview-style questions across SQL topicsTimed 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

This foundation block introduces filtering, grouping, and joins. Practise these before moving to multi-stage queries.

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 US$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 US$100,000
SELECT category, SUM(order_amount) AS revenue
FROM orders
GROUP BY category
HAVING SUM(order_amount) > 100000;

Days 7–10: All JOIN Types

JOINs combine related records across tables. 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 calculate values across related rows while preserving each row. Practise ranking, comparing consecutive records, and running totals.

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. Active practice helps you check whether you can apply the syntax. Use our free live compiler β†’

⭐ Key Takeaways

  • Use 30 days as a suggested schedule with 1–2 hours daily β€” basics in week 1, advanced in weeks 2–3, practice in week 4
  • Days 1–10 cover foundational query patterns β€” GROUP BY, JOINs and basic aggregations
  • Days 15–20 on window functions is your biggest differentiator β€” practise these on small datasets
  • The anti-join pattern (LEFT JOIN + WHERE IS NULL) is useful for finding unmatched records β€” practise 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?
+
Thirty days can provide a structured introduction to SQL. Progress depends on your starting point and practice; completing the schedule does not guarantee interview readiness or a job offer.
What SQL topics are asked in data analyst interviews in India?
+
Practise aggregations, JOINs, window functions, CTEs, and subqueries. Use role requirements to prioritise your practice.
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?
+
Choose a mix of easy, medium, and hard exercises. Explain the output and test edge cases rather than aiming only for a question count. The question page currently contains 14 worked SQL questions.

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
Prakhar Shrivastava Β· Founder, Data Analyst Interview
Former analytics lead at top product companies. Helping data analysts practise interviews through structured, practical preparation.

Documentation and next steps

Check the relevant documentation for your software version and database dialect. These are practice resources, not verified employer question banks.

Find a related learning guide Β· About the author Β· Suggest a correction

Leave a Reply

Discover more from Data Analyst Interview

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

Continue reading