TGViewer
Data Analyst Interview Resources Data Analyst Interview Resources @dataanalystinterview · 52.5K subscribers
Post #736 2.05K
Recent Interview Question for Data Analyst Role

Question 1) You have two tables:

Employee:-
Columns: EID (Employee ID), ESalary (Employee Salary)

empdetails:-
Columns: EID (Employee ID), EDOB (Employee Date of Birth)

Your task is to:
1) Identify all employees whose salary (ESalary) is an odd number?
2) Retrieve the date of birth (EDOB) for these employees from the empdetails table.

How would you write a SQL query to achieve this?

SELECT e.EID, ed.EDOB
FROM (
SELECT EID
FROM Employee
WHERE ESalary % 2 <> 0
) e
JOIN empdetails ed ON e.EID = ed.EID;

Explanation of the query :-

Filter Employees with Odd Salaries:

The subquery SELECT EID FROM Employee WHERE ESalary % 2 <> 0 filters out Employee IDs (EID) where the salary (ESalary) is an odd number. The modulo operator % checks if ESalary divided by 2 leaves a remainder (<>0).

Merge with empdetails:

The main query then takes the filtered Employee IDs from the subquery and performs a join with the empdetails table using the EID column. This retrieves the date of birth (EDOB) for these employees.

Hope this helps you 😊
  • 👍 3
More from @dataanalystinterview
  1. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  2. Oct 13, 2026✅ Complete Roadmap to Learn SQL (Structured Query Language) 🧠💻 Week 1: SQL Basics - What…
  3. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  4. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
  5. Oct 9, 2026✅SQL Roadmap: Step-by-Step Guide to Master SQL 🧠💻 Whether you're aiming to be a backend…
  6. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →