Data Analyst (SQL) Interview Questions & Answers
40 questions for Data Analyst (SQL) interviews — 22 easy, 17 medium, 1 hard.
About the Data Analyst (SQL) role
A Data Analyst uses SQL every day to pull, clean and summarise data for reports and business questions, often combined with Excel, Power BI or Tableau. Typical work includes sales and funnel analysis, cohort and retention reports, and ad-hoc requests from managers. Strong joins, aggregation and window function skills are the core of analyst interviews in India.
Find the number of employees and average salary in each department.
Show answer
What is a CTE and why use it?
Show answer
Find employees who earn more than their department average.
Show answer
Why should we hire you for a SQL or data role as a fresher?
Show answer
Calculate a running total of daily sales.
Show answer
Your GROUP BY query returns an error that a column is not in the group by clause. How do you fix it?
Show answer
Rank employees by salary within each department.
Show answer
What is the difference between COUNT(*), COUNT(column) and COUNT(DISTINCT column)?
Show answer
Describe a time you reviewed someone else's SQL and suggested improvements.
Show answer
What is the difference between IN and EXISTS?
Show answer
What is the difference between GROUP BY and window functions?
Show answer
What do PARTITION BY and ORDER BY do inside OVER?
Show answer
What is a CROSS JOIN and when is it useful?
Show answer
What is a self join? Give an example.
Show answer
Compare this month's and last month's sales per product using a full outer join.
Show answer
Get the top 2 highest paid employees in each department.
Show answer
What is the difference between ROWS and RANGE frames?
Show answer
What is a lateral join or CROSS APPLY?
Show answer
What is the difference between MIN/MAX on numbers and on strings or dates?
Show answer
Tell me about a time you significantly improved query performance.
Show answer
What is the difference between clustered and non-clustered indexes?
Show answer
After joining orders with payments, revenue doubled. What went wrong?
Show answer
You need to delete duplicate rows but keep one copy of each. How do you do it?
Show answer
Write a query to list orders with customer names.
Show answer
How does AVG treat NULL values?
Show answer
Explain 1NF, 2NF and 3NF with simple examples.
Show answer
Your NOT IN query returns zero rows even though you expect results. What do you check?
Show answer
Find employees earning more than the company average.
Show answer
What is GROUP BY and what is the rule for selected columns?
Show answer
Write a query to show each employee with their manager's name.
Show answer
What do NTILE, PERCENT_RANK and CUME_DIST do?
Show answer
Match each employee's salary to a grade using a range table.
Show answer
How do you approach a SQL problem you have never seen before in an interview?
Show answer
Find duplicate email addresses in a users table.
Show answer
What happens when you join on a column that has NULL values?
Show answer
An interviewer asks to show each employee's salary next to their department's average. How do you do it?
Show answer
What is the difference between ROW_NUMBER, RANK and DENSE_RANK?
Show answer
What are LAG and LEAD functions?
Show answer
What is a join and what types of joins exist?
Show answer
Frequently asked questions
What does a Data Analyst (SQL) do?
A Data Analyst uses SQL every day to pull, clean and summarise data for reports and business questions, often combined with Excel, Power BI or Tableau. Typical work includes sales and funnel analysis, cohort and retention reports, and ad-hoc requests from managers. Strong joins, aggregation and window function skills are the core of analyst interviews in India.
Which skills are tested in a Data Analyst (SQL) interview?
Expect questions on SQL queries, Window functions, Excel, Data cleaning, Reporting. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a Data Analyst (SQL) interview?
Revise Joins, Aggregation and Grouping, Window Functions, Subqueries and CTEs first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.