op 10 SQL Interview Questions Every Data Analyst Should Practice in 2026
SQL continues to be one of the most important skills for data analysts, business analysts, and data professionals. Whether you're preparing for placements, internships, or full-time roles, strong SQL fundamentals can significantly improve your interview performance.
In this blog, we’ll cover some of the most commonly asked SQL interview questions along with practical explanations to help you prepare smarter.
1. What is the difference between WHERE and HAVING?
This is one of the most common SQL interview questions.
WHERE filters rows before aggregation
HAVING filters groups after aggregation
Example:
SELECT department, COUNT(*)
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;2. Difference Between INNER JOIN and LEFT JOIN
Interviewers often test your understanding of joins.
INNER JOIN returns matching records from both tables
LEFT JOIN returns all records from the left table and matched records from the right table
Understanding joins is extremely important for analytics interviews.
3. What is a Primary Key?
A Primary Key uniquely identifies each record in a table.
Features:
Cannot contain NULL values
Must contain unique values
One primary key per table
Example:
CREATE TABLE users (
user_id INT PRIMARY KEY,
name VARCHAR(100)
);4. Explain GROUP BY in SQL
GROUP BY is used to group rows that have the same values into summary rows.
Example:
SELECT city, COUNT(*)
FROM customers
GROUP BY city;This question is frequently asked in fresher interviews.
5. Difference Between DELETE, DROP, and TRUNCATE
A very popular theoretical question.
DELETE removes rows
TRUNCATE removes all rows quickly
DROP deletes the entire table
Interviewers ask this to check database fundamentals.
6. What Are Aggregate Functions?
Aggregate functions perform calculations on multiple rows.
Examples:
COUNT()
SUM()
AVG()
MAX()
MIN()
These are heavily used in analytics roles.
7. Explain Normalization
Normalization helps reduce data redundancy and improve database efficiency.
Common forms:
1NF
2NF
3NF
Freshers are often asked basic normalization concepts.
8. What is the Difference Between UNION and UNION ALL?
UNION removes duplicates
UNION ALL keeps duplicates
Example:
SELECT name FROM employees
UNION
SELECT name FROM managers;9. What is a Subquery?
A subquery is a query inside another query.
Example:
SELECT name
FROM employees
WHERE salary > (
SELECT AVG(salary)
FROM employees
);Subqueries are important for intermediate-level SQL interviews.
10. How Do You Improve SQL Query Performance?
Some common optimization techniques:
Use indexes
Avoid SELECT *
Use proper joins
Optimize WHERE clauses
Limit unnecessary subqueries
This question is often asked in experienced interviews.
Final Tips for SQL Interviews
Preparing SQL theoretically is not enough. The best way to improve is by practicing real interview scenarios with other people.
At MatchMyInterview, you can practice mock interviews with real peers preparing for similar roles and improve your confidence through live practice sessions.
Consistent practice is what helps candidates perform better in actual interviews.
🚀 Practice smarter.
☕ Connect with peers.
🎯 Get interview-ready.
Try MatchMyInterview today.
