Join our telegram channel to learn how data analysis can reveal fascinating patterns, trends, and stories hidden within the numbers! ๐
For ads & suggestions: @love_data
Post #2402
1.43K
๐ฅ SQL Interview Question of the Day
๐ Scenario:
A company wants to identify employees who share the same salary with at least one other employee.
You have one table:
employees
โข employee_id
โข employee_name
โข salary
โ Solution:
SELECT
employee_id,
employee_name,
salary
FROM employees
WHERE salary IN (
SELECT salary
FROM employees
GROUP BY salary
HAVING COUNT(*) > 1
);
๐ก Concept Tested:
Subquery + GROUP BY + HAVING
โค๏ธ React if you want more SQL interview questions.
๐ Scenario:
A company wants to identify employees who share the same salary with at least one other employee.
You have one table:
employees
โข employee_id
โข employee_name
โข salary
โ Solution:
SELECT
employee_id,
employee_name,
salary
FROM employees
WHERE salary IN (
SELECT salary
FROM employees
GROUP BY salary
HAVING COUNT(*) > 1
);
๐ก Concept Tested:
Subquery + GROUP BY + HAVING
โค๏ธ React if you want more SQL interview questions.
- โค 8







