Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

TCS NQT SQL Coding
SQL

TCS NQT SQL Coding

Practice SQL coding questions based on common TCS NQT-style patterns, query problems, filtering, joins, aggregation, and data manipulation.

Create an Employee table with Employee_ID, Name, Department, and Salary

Insert records into the Employee table

Create a Department table

Insert records into the Department table

Retrieve all employee records

Retrieve only employee name and department

Find employees from the IT department

Find employees with salary greater than 55,000

Find employees whose salary is between 50,000 and 60,000

Find employees whose salary is greater than the average salary

Find the employee(s) with the highest salary

Find the second highest salary

Find the maximum salary in each department

Find the average salary of all employees

Find the department with the highest total salary

Count the total number of employees

Count employees in each department

Find departments having more than one employee

Find duplicate employee names

Find duplicate department entries

Retrieve only unique department names

List all unique department names from Employee and Department tables

Sort employees by salary in descending order

Sort employees by department (ASC) and salary (DESC)

Display the top 3 highest-paid employees

Display employee name with department name

Find employees without a valid department

Find departments with no employees

Find employees whose salary is greater than their manager's salary

Display employee and manager names

Rank employees by salary within each department

Calculate cumulative salary within each department

Find the highest-paid employee in each department

Find employees who joined in the last 6 months

Find customers who have not made any purchases

Find the first and last purchase date for each customer

Find employees whose name starts with 'A'

Find employees whose name ends with 'e'

Find employees whose name contains 'a'

Display salary with a currency symbol

Retrieve a random record from a table

Swap values A and B in a column without updating the table

Clone a table including all data without CREATE TABLE

Clone a table structure only (without data)

Predict the output of a CROSS JOIN when one table is empty

Print numbers from 1 to 100 without using loops

Print numbers from 1 to 100 using a WHILE loop

Count occurrences of a character in a string

Predict the output of a derived table using UNION ALL

Predict the output of SUM() when one value is NULL

Perform integer division and return a decimal result

Predict the output of a CASE statement

Create a temporary table

Insert sample values into a temporary table

Transform column values using CASE

Find the maximum salary

Find the minimum salary

Find the total salary paid

My Private Notes

Notes are auto-saved locally to this device.