All resources
Interview QuestionsNov 4, 202612 min read

SQL Interview Questions for Freshers (India, 2026): Joins, GROUP BY, Window Functions & Query Practice

SQL is asked in almost every fresher interview in India — for developer, data analyst, testing and support roles at TCS, Infosys, Wipro, Accenture, Cognizant and at startups. Interviewers check whether you understand the concepts and can write a correct query on paper or a shared screen without help. Here are the question types you will actually face, grouped by topic, with what a good answer covers.

How SQL is tested in fresher interviews

  1. Online assessment — MCQs on query output, keys and normalization, sometimes one query to write.
  2. Technical interview — DBMS concepts, then 1–3 queries written live on a small table like Employee or Orders.
  3. Role depth — data roles add window functions and business questions; developer roles add indexes, transactions and joins with code.
  4. HR round — communication, relocation and why this role or company.

Selection steps and test sections change between hiring drives. Always confirm the current pattern on the company's official careers page or your drive invitation before you prepare.

SQL and DBMS basics

  1. What is SQL? Difference between SQL and MySQL.
  2. What are DDL, DML, DCL and TCL? Give one command for each.
  3. Difference between DELETE, TRUNCATE and DROP.
  4. What are primary key, foreign key, unique key and candidate key?
  5. Difference between primary key and unique key.
  6. What are constraints? Name NOT NULL, CHECK, DEFAULT and others.
  7. What does NULL mean? Why does = NULL not work, and what do you use instead?
  8. Difference between CHAR and VARCHAR.

Joins

  1. Explain INNER, LEFT, RIGHT and FULL OUTER JOIN with a small example.
  2. What is a self join? Show each employee with their manager's name.
  3. What is a CROSS JOIN and when would you use it?
  4. Find customers who never placed an order (LEFT JOIN + IS NULL).
  5. Difference between UNION and UNION ALL.

Filtering, grouping and subqueries

  1. Difference between WHERE and HAVING.
  2. What is the order of execution of a SELECT query (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY)?
  3. Difference between COUNT(*), COUNT(column) and COUNT(DISTINCT column).
  4. What is a subquery? Difference between correlated and non-correlated subqueries.
  5. Difference between IN and EXISTS.
  6. What is a CTE (WITH clause) and why is it easier to read than nested subqueries?

Window functions (asked more every year)

  1. Difference between ROW_NUMBER, RANK and DENSE_RANK, with an example of ties.
  2. Top 3 salaries in each department using PARTITION BY.
  3. Running total of sales by date using SUM() OVER (ORDER BY ...).
  4. Use LAG or LEAD to compare this month's sales with last month's.

Design, indexes and transactions

  1. What is normalization? Explain 1NF, 2NF and 3NF in simple words.
  2. What is denormalization and when is it useful?
  3. What is an index? How does it speed up reads, and what is the cost?
  4. Difference between clustered and non-clustered index.
  5. What are ACID properties of a transaction?
  6. What is a view? Difference between a view and a table.
  7. What is a stored procedure, and how is it different from a function?

10 SQL queries to practise before your interview

  1. Find the second-highest salary (with LIMIT/OFFSET and with DENSE_RANK).
  2. Find the Nth highest salary.
  3. Find duplicate emails in a table.
  4. Delete duplicate rows but keep one.
  5. Count employees in each department and show only departments with more than 5.
  6. Find employees who earn more than their manager.
  7. Show department-wise highest salary with the employee's name.
  8. Find customers who ordered in every month of a quarter.
  9. Find employees who joined in the last 6 months.
  10. Calculate month-on-month revenue growth percentage.

Say your approach before writing: which tables, which join, what you group by, and how you handle NULLs and ties. Interviewers give marks for clear thinking even if syntax is slightly off.

Project and HR questions

  • Which database did you use in your project, and what tables did you design?
  • Tell me about a query that was slow or wrong and how you fixed it.
  • Tell me about yourself.
  • Why should we hire you for this role?

2-week SQL prep plan

  1. Days 1–2: basics — DDL/DML, keys, constraints, NULL handling.
  2. Days 3–4: all joins, plus self join and UNION.
  3. Days 5–6: GROUP BY, HAVING, subqueries and CTEs; write 5 queries a day.
  4. Days 7–8: window functions — ranking, running totals, LAG/LEAD.
  5. Day 9: normalization, indexes, ACID, views.
  6. Days 10–11: solve the 10 practice queries above without looking at answers.
  7. Day 12: prepare your project database story and 'tell me about yourself'.
  8. Days 13–14: take full mock interviews out loud and fix the weak answers.

Recommended next action

Take the next concrete step — it's free, takes under a minute, and gives you a real score to act on.

Keep reading

Interview Questions

Java Interview Questions for Freshers (India, 2026): Core Java, OOP, Collections & Coding

Top Java interview questions for freshers in India: core Java, OOP, strings, exceptions, collections, multithreading, Java 8, coding programs and a 2-week prep plan for TCS, Infosys, Wipro and product companies.

Read
Interview Questions

Python Interview Questions for Freshers (India, 2026): Basics, OOP, Data Structures & Coding

Top Python interview questions for freshers in India: basics, data types, lists vs tuples, OOP, exceptions, generators, decorators, coding programs and a 2-week prep plan for TCS, Infosys, Wipro and startups.

Read
Interview Questions

Data Analyst Interview Questions for Freshers (India, 2026): SQL, Excel, Python, Statistics & Case Questions

Top data analyst interview questions for freshers in India: SQL queries, Excel, Python and pandas, statistics, Power BI/Tableau, case and guesstimate questions, plus a 2-week prep plan.

Read
Interview Questions

SQL Interview Questions for Software Engineers (2026)

Hand-picked sql interview questions for software engineer candidates with structured sample answers and what interviewers are listening for.

Read
Interview Questions

SQL Interview Questions for Data Analysts (2026)

Hand-picked sql interview questions for data analyst candidates with structured sample answers and what interviewers are listening for.

Read
Interview Questions

SQL Interview Questions for Data Scientists (2026)

Hand-picked sql interview questions for data scientist candidates with structured sample answers and what interviewers are listening for.

Read