Home › Interview Questions › Write five SQL queries.

Write five SQL queries.

🟡 Medium Coding Junior level
1Times asked
Jun 2026Last seen
Jun 2026First seen

💡 Model Answer

  1. Retrieve all columns from the Employees table:

SELECT * FROM Employees;

  1. Get employee names and salaries where salary exceeds 50,000:

SELECT Name, Salary FROM Employees WHERE Salary > 50000;

  1. Count employees per department:

SELECT DepartmentID, COUNT(*) AS EmployeeCount FROM Employees GROUP BY DepartmentID;

  1. Join Employees with Departments to show employee name and department name:

SELECT e.Name, d.DepartmentName

FROM Employees e

JOIN Departments d ON e.DepartmentID = d.ID;

  1. Find employees hired after January 1, 2023:

SELECT Name, HireDate FROM Employees WHERE HireDate > '2023-01-01';

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500