SQL remains one of the most important skills for data analysts, software developers, database administrators, and business intelligence professionals. Whether you are preparing for your first job or planning to switch companies, knowing the right SQL Interview Questions can give you a strong advantage.
Companies like TCS, Wipro, and Infosys regularly ask SQL questions to test a candidate's understanding of databases, queries, joins, functions, and problem-solving abilities.
In this guide, we will cover the Top SQL Interview Questions Asked in TCS, Wipro, and Infosys, along with simple explanations and examples to help students, beginners, and professionals prepare confidently.
Why Do TCS, Wipro, and Infosys Ask SQL Questions?
Most IT companies work with large amounts of data. SQL helps businesses store, manage, and analyze information efficiently.
Interviewers usually check:
Database knowledge
Query writing skills
Logical thinking
Problem-solving ability
Understanding of real-world scenarios
Mastering SQL Interview Questions Asked at TCS, SQL Interview Questions Asked at Wipro, and SQL Interview Questions Asked at Infosys can significantly improve your chances of selection.
Top SQL Interview Questions Asked in TCS, Wipro, and Infosys
1. What is SQL?
SQL stands for Structured Query Language. It is used to create, manage, retrieve, and modify data stored in relational databases.
Example
</> SQL
SELECT * FROM Employees;This query retrieves all records from the Employees table.
2. What is the Difference Between SQL and MySQL?
SQL | MySQL |
SQL is a language | MySQL is a database management system |
Used for querying databases | Used to store and manage databases |
Standard language | Software implementation |
3. What are Primary Keys?
A Primary Key uniquely identifies each row in a table.
Example
</> SQL
Employee_IDCharacteristics:
Cannot contain NULL values
Must be unique
Only one primary key per table
4. What is a Foreign Key?
A Foreign Key connects two tables.
Example
Orders Table:
</> SQL
Customer_IDCustomers Table:
</> SQL
Customer_IDIt creates relationships between tables.
5. What is the Difference Between DELETE, DROP, and TRUNCATE?
DELETE | TRUNCATE | DROP |
Removes rows | Removes all rows | Deletes entire table |
Can use WHERE clause | No WHERE clause | Removes structure |
Can rollback | Limited rollback | Cannot recover easily |
6. What are Constraints in SQL?
Constraints help maintain data accuracy.
Common constraints include:
PRIMARY KEY
FOREIGN KEY
UNIQUE
CHECK
NOT NULL
DEFAULT
Example:
</> SQL
CREATE TABLE Students(
ID INT PRIMARY KEY,
Name VARCHAR(50) NOT NULL
);7. What is Normalization?
Normalization organizes database tables to reduce duplication.
Types include:
First Normal Form (1NF)
Removes repeating groups.
Second Normal Form (2NF)
Eliminates partial dependencies.
Third Normal Form (3NF)
Removes transitive dependencies.
This is one of the most common SQL Interview Questions Asked at Infosys.
8. What are Joins in SQL?
Joins combine data from multiple tables.
INNER JOIN
Returns matching records.
</> SQL
SELECT *
FROM Employees
INNER JOIN Departments
ON Employees.DeptID = Departments.DeptID;LEFT JOIN
Returns all rows from the left table.
RIGHT JOIN
Returns all rows from the right table.
FULL JOIN
Returns all matching and non-matching rows.
9. What is the Difference Between WHERE and HAVING?
WHERE | HAVING |
Filters rows | Filters groups |
Used before GROUP BY | Used after GROUP BY |
Cannot use aggregate functions | Can use aggregate functions |
Example:
</> SQL
SELECT Department,
COUNT(*)
FROM Employees
GROUP BY Department
HAVING COUNT(*) > 5;10. What is the Difference Between UNION and UNION ALL?
UNION
Removes duplicate records.
UNION ALL
Keeps duplicate records.
Example:
</> SQL
SELECT Name FROM Table1
UNION
SELECT Name FROM Table2;11. What is a View in SQL?
A View is a virtual table created from a query.
Example:
</> SQL
CREATE VIEW Employee_View AS
SELECT Name, Salary
FROM Employees;Benefits:
Better security
Simplifies complex queries
Easier reporting
12. What is an Index?
Indexes improve query performance.
Example:
</> SQL
CREATE INDEX idx_name
ON Employees(Name);Advantages:
Faster searches
Better query optimization
Disadvantage:
Requires extra storage space
13. What is the Difference Between CHAR and VARCHAR?
CHAR | VARCHAR |
Fixed length | Variable length |
Faster access | Saves storage |
Uses more space | Uses less space |
14. Explain Aggregate Functions
Aggregate functions perform calculations on multiple rows.
Common functions include:
</> SQL
COUNT()
SUM()
AVG()
MAX()
MIN()Example:
</> SQL
SELECT AVG(Salary)
FROM Employees;15. What is GROUP BY?
GROUP BY combines rows having similar values.
Example:
</> SQL
SELECT Department,
COUNT(*)
FROM Employees
GROUP BY Department;16. What are Subqueries?
A subquery is a query inside another query.
Example:
</>SQL
SELECT Name
FROM Employees
WHERE Salary >
(
SELECT AVG(Salary)
FROM Employees
);17. What is the Difference Between Clustered and Non-Clustered Index?
Clustered Index | Non-Clustered Index |
Stores data physically | Stores pointers |
One per table | Multiple allowed |
Faster retrieval | Slightly slower |
18. What is a Self Join?
A Self Join joins a table with itself.
Example:
</> SQL
SELECT A.Name,
B.Name
FROM Employees A,
Employees B
WHERE A.ManagerID = B.EmployeeID;19. What is a Stored Procedure?
Stored procedures are saved SQL statements.
Example:
</> SQL
CREATE PROCEDURE EmployeeList
AS
SELECT * FROM Employees;Benefits include:
Reusability
Better security
Faster execution
20. What is a Trigger?
Triggers execute automatically when specific events occur.
Example:
</> SQL
AFTER INSERT
AFTER DELETE
AFTER UPDATETriggers are often included among Top SQL Interview Questions Asked in TCS, Wipro, and Infosys.
SQL Coding Questions Frequently Asked in Interviews
Companies also focus on practical SQL coding rounds.
Find the Second Highest Salary
</> SQL
SELECT MAX(Salary)
FROM Employees
WHERE Salary <
(
SELECT MAX(Salary)
FROM Employees
);Find Duplicate Records
</> SQL
SELECT Name,
COUNT(*)
FROM Employees
GROUP BY Name
HAVING COUNT(*) > 1;Find Employees Earning More Than Average Salary
</> SQL
SELECT *
FROM Employees
WHERE Salary >
(
SELECT AVG(Salary)
FROM Employees
);Fetch Alternate Records
</> SQL
SELECT *
FROM Employees
WHERE MOD(EmployeeID,2)=0;These practical queries are commonly asked in SQL Interview Questions Asked at TCS, SQL Interview Questions Asked at Wipro, and SQL Interview Questions Asked at Infosys.
Tips to Crack SQL Interviews in TCS, Wipro, and Infosys
Preparing for SQL interviews requires more than memorizing definitions.
Practice Every Day
Spend at least 30 minutes solving SQL queries daily.
Learn Through Real Projects
Create small databases such as:
Student Management System
Online Shopping Database
Library Management System
Employee Payroll System
Understand Concepts Clearly
Interviewers prefer candidates who understand concepts rather than those who memorize answers.
Focus on Query Optimization
Learn how indexes work and how to write efficient queries.
Solve Previous Interview Questions
Practicing company-specific questions improves confidence and speed.
Benefits of Learning SQL
SQL is useful in many careers.
Some advantages include:
High demand in IT companies
Better job opportunities
Useful for data analysis
Important for business intelligence
Valuable skill for software development
Students preparing for placements should prioritize learning these SQL Interview Questions because they appear regularly in hiring drives.
FAQs
1. What are the most common SQL Interview Questions asked in TCS?
TCS commonly asks questions on joins, normalization, indexes, aggregate functions, subqueries, views, and query-based problems like finding the second highest salary.
2. What SQL topics should beginners focus on?
Beginners should learn SELECT statements, joins, GROUP BY, HAVING, aggregate functions, constraints, subqueries, views, and stored procedures.
3. Does Wipro ask SQL coding questions?
Yes. Wipro often asks practical SQL queries, including duplicate records, ranking, salary-based questions, joins, and nested queries.
4. Are SQL questions difficult in Infosys interviews?
Infosys generally asks moderate-level SQL questions. Strong understanding of database concepts and regular practice can help candidates answer confidently.
5. How can I prepare for SQL interviews effectively?
Practice SQL daily, solve interview questions, work on mini projects, understand database concepts, and focus on writing optimized queries.
Conclusion
SQL continues to be one of the most in-demand technical skills in the IT industry. Companies like TCS, Wipro, and Infosys regularly include SQL rounds to assess candidates' database knowledge and problem-solving abilities.
By preparing these SQL Interview Questions, practicing real-world queries, and understanding database concepts, students and beginners can improve their confidence and increase their chances of getting selected in top companies.
Consistent practice, hands-on projects, and learning from industry-focused training can make a significant difference in your interview preparation. Brillica Services provides SQL Course designed to help students build practical database skills, work on real-world queries, and prepare confidently for technical interviews and career opportunities in the data and software industry.


