Mastering SQL: The Top 10 Questions Every Data Analyst Must Know in 2025

SQL remains the cornerstone of data analysis and business intelligence. Whether you're a fresh graduate or a seasoned pro, you can expect SQL to be a key part of your interview process.

At Datavetaa, we’ve helped countless students and professionals land their dream jobs by mastering these SQL concepts and applying them in real-world BI tools like Power BI.

Here are the Top 10 SQL Interview Questions with answers that go beyond the basics.


1. The Different Types of SQL Joins 🤝

SQL joins are fundamental to combining data from multiple tables.

  • INNER JOIN → Returns rows with matches in both tables.

  • LEFT JOIN → Returns all rows from the left table + matches from right.

  • RIGHT JOIN → The opposite of LEFT JOIN.

  • FULL OUTER JOIN → Returns all rows, matched and unmatched.

👉 Practice these with case studies in our Power BI + Advanced SQL Training in Pune.


2. WHERE vs. HAVING: What's the Difference? 🤔

  • WHERE filters rows before aggregation.

  • HAVING filters groups after aggregation.

Example:

SELECT dept_id, COUNT(*)
FROM Employees
WHERE salary > 50000
GROUP BY dept_id
HAVING COUNT(*) > 5;

Think of WHERE as selecting apples before putting them in baskets, and HAVING as choosing baskets with more than 10 apples.


3. Understanding Window Functions 🖼️

Window functions perform calculations across related rows without collapsing them.

Example: ranking employees by salary:

SELECT name, salary,
RANK() OVER (ORDER BY salary DESC) AS salary_rank
FROM Employees;

4. UNION vs. UNION ALL 📋

  • UNION removes duplicates (slower).

  • UNION ALL keeps duplicates (faster).


5. Common Table Expressions (CTEs) 🧱

A CTE improves query readability for complex problems.

WITH HighSalaryEmployees AS (
  SELECT name, salary
  FROM Employees
  WHERE salary > 100000
)
SELECT * FROM HighSalaryEmployees;

6. Finding Duplicate Records 🔎

SELECT name, COUNT(*)
FROM Employees
GROUP BY name
HAVING COUNT(*) > 1;

7. What Is Indexing and Why Use It? 🚀

Indexes speed up queries (like the index in a book).

  • Faster SELECT queries.

  • Better JOIN performance.

⚠️ Trade-offs: requires disk space, slows down writes.


8. The Purpose of Database Normalization 🧹

Normalization reduces redundancy and improves data integrity.

  • 1NF → Atomic values, no repeating groups.

  • 2NF → Non-key attributes fully depend on PK.

  • 3NF → No transitive dependency.


9. Top Query Optimization Tips 🛠️

  • Use indexes wisely.

  • Avoid SELECT *.

  • Filter early with WHERE.

  • Choose correct JOINs.

  • Analyze execution plans.


10. How to Find the Nth Highest Salary 📈

Method 1: Subquery

SELECT MAX(salary)
FROM Employees
WHERE salary < (SELECT MAX(salary) FROM Employees);

Method 2: Window Function

WITH RankedSalaries AS (
  SELECT salary,
  DENSE_RANK() OVER (ORDER BY salary DESC) as rank_num
  FROM Employees
)
SELECT salary
FROM RankedSalaries
WHERE rank_num = 2;

Final Thoughts 💡

SQL is a skill that grows with you. Don’t just memorize answers—apply them on real datasets and combine them with tools like Power BI.

At Datavetaa, we prepare students with:

  • Advanced SQL practice,

  • Real interview-style case studies, and

  • Integrated Power BI + SQL training for BI careers.

📍 Ready to level up?
👉 Explore the Best Power BI Training in Pune with Datavetaa and prepare for BI/Data Analyst roles.


Related Reads


Stay up-to-date with the latest technologies trends, IT market, job post & etc with our blogs

Contact Support

Contact us

By continuing, you accept our Terms of Use, our Privacy Policy and that your data.

Join more than1000+ learners worldwide