11 SQL Interview Questions Indian Freshers Get Wrong
11 SQL interview questions that trip up Indian freshers most often, with answers TCS, Infosys, and Wipro interviewers expect. Includes query examples and prep tips.

11 SQL Interview Questions Indian Freshers Get Wrong
If you're applying for data analyst, software developer, or BI roles in India, SQL is non-negotiable. Companies like TCS, Infosys, Wipro, and Cognizant run SQL rounds in nearly every technical interview — and freshers keep failing the same questions. Glassdoor India lists 423 open fresher SQL jobs, Naukri shows 46,000+ SQL fresher vacancies, and average salary is ₹3,00,000/year, That salary grows to ₹6L+ with experience — if you can clear the SQL round.
Here are 11 questions that trip up Indian freshers, with answers that satisfy interviewers at TCS, Infosys, and Wipro.
1. What is the difference between DELETE, TRUNCATE, and DROP?
Freshers mix these up constantly. DELETE removes rows with WHERE and can be rolled back. TRUNCATE removes all rows, resets identity, and cannot use WHERE. DROP deletes the entire table structure and data. TCS and Wipro ask this to test whether you understand transaction control versus DDL.
2. Write a query to find the second highest salary
The most asked SQL query question in Indian IT interviews:
SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees)
Interviewers follow up by asking for the Nth highest using DENSE_RANK(). Practice both — Infosys specifically asks for the window function version.
3. What is the difference between WHERE and HAVING?
WHERE filters rows before grouping. HAVING filters groups after GROUP BY. You cannot use aggregate functions like COUNT() in WHERE, but you can in HAVING. Example: SELECT department, COUNT(*) FROM employees GROUP BY department HAVING COUNT(*) > 5. This appears in 80% of Indian MNC fresher interviews.
4. Explain INNER JOIN vs LEFT JOIN vs RIGHT JOIN
INNER JOIN returns only matching rows. LEFT JOIN returns all left rows plus matches (NULLs where no match). RIGHT JOIN does the opposite. Be ready to write a join on a whiteboard — Cognizant asks you to combine employees and departments tables live.
5. What is normalization? Explain 1NF, 2NF, and 3NF
Normalization reduces data redundancy. 1NF: each cell holds a single value. 2NF: every non-key column depends on the full primary key. 3NF: no non-key column depends on another non-key column. Infosys asks this expecting a concrete example, not just definitions.
6. What is the difference between UNION and UNION ALL?
UNION combines result sets and removes duplicates. UNION ALL keeps duplicates and is faster since it skips deduplication. If no duplicates exist, always use UNION ALL. Wipro checks for this performance answer.
7. What are primary keys and foreign keys?
A primary key uniquely identifies each row — it cannot be NULL and must be unique. A foreign key references a primary key in another table, enforcing referential integrity. Example: Orders table has customer_id as a foreign key referencing Customers. Freshers forget that primary keys cannot be NULL.
8. How does GROUP BY work with aggregate functions?
GROUP BY groups rows sharing a column value, then aggregates like SUM(), COUNT(), AVG() operate on each group. Example: SELECT department, AVG(salary) FROM employees GROUP BY department gives average salary per department. TCS asks you to combine GROUP BY with HAVING to filter groups.
9. What is a subquery? Types of subqueries?
A correlated subquery references the outer query and runs once per row. A non-correlated subquery runs independently. Example: SELECT name FROM employees e WHERE salary > (SELECT AVG(salary) FROM employees WHERE department = e.department) — finds employees earning above their department average.
10. What are indexes and when should you avoid them?
Indexes speed up retrieval by creating a lookup on a column. Use them on WHERE, JOIN, and ORDER BY columns. Avoid indexes on tables with frequent INSERT/UPDATE/DELETE — each index must update too. Accenture tests read vs write trade-offs.
11. What is the difference between SQL and MySQL?
SQL is a standard query language. MySQL is a database system that implements it — along with PostgreSQL, Oracle, and SQL Server. Freshers often say "SQL is a database" — it's a language. Interviewers use this to check fundamental clarity.
How to Prepare for SQL Interviews in India
Indian IT companies test practical query writing. Practice on HackerRank and LeetCode. TCS tests fundamentals; Accenture adds date-filtering and self-joins.
For mock interview practice with SQL technical rounds, try PrepFox's AI mock interview tool. Pair it with PrepFox's resume builder to ensure your SQL skills are keyword-optimized for ATS screening.
The Bottom Line
Master these 11 questions, practice writing queries by hand, and you'll clear the SQL round at any Indian IT firm. The jobs are there — 46,000+ on Naukri alone.
Ready to put this into practice?
Practice mock interviews, build your resume, and get expert feedback — all on PrepFox.
More from PrepFox Blog
How to Crack Aptitude Interview Questions in Placements
How to crack aptitude interview questions in Indian placements: quant, reasoning and verbal sections, an 8-week plan, and test-day strategy.
9 Questions to Ask the Interviewer That Impress HR
Interview questions to ask the interviewer: 9 smart questions that impress Indian HR, what each one signals, and what never to ask in round one.
How to Answer Civil Interview Questions as a Fresher
How to answer civil interview questions as a fresher in India: slump test, foundations, cement tests and salary data for site engineer offers.
