🗄️ SQL Interview Prep

Master SQL for Data Analyst Interviews

From basic queries to advanced window functions — learn exactly what top companies ask and how to answer confidently.

Sample Questions
What interviewers actually ask

These exact questions have been asked at top Indian and global tech companies.

Easy
Write a query to find the second highest salary in an employee table.
Topic: Subqueries · Asked at: Infosys, Wipro, TCS
Medium
Find customers who placed orders in January 2024 but not in February 2024.
Topic: Joins + Date filtering · Asked at: Flipkart, Swiggy
Medium
For each department, find the employee with the highest salary using window functions.
Topic: Window Functions · Asked at: Amazon, Paytm
Hard
Calculate the 7-day rolling average of daily active users for each product.
Topic: Window Functions + CTEs · Asked at: Google, Uber
Hard
Find users who logged in on 3 or more consecutive days in the last 30 days.
Topic: Self Joins + Date logic · Asked at: Meta, PhonePe
Interview Tips
How to approach SQL rounds
🗣️

Think out loud

Interviewers want to hear your thought process. Say what you’re doing before you write it — even if you make mistakes.

🔍

Clarify the question first

Before writing a single line, ask about edge cases. Are nulls possible? Is the date format consistent? This impresses interviewers.

Verify with sample data

After writing your query, trace through it with 2-3 sample rows in your head to confirm it gives the right output.

Know window functions deeply

RANK, ROW_NUMBER, LAG, LEAD, and SUM OVER are asked in 80% of senior analyst interviews. Practise these daily.

Ready to crack your SQL interview?

Book a free mock SQL interview session with our expert mentors.

Book Free SQL Session