Programming & Development / April 15, 2025

Employee Bonus Query – Find Employees with Bonus Less Than 1000

sql employee bonus empId salary supervisor join tables filter bonus employee name bonus amount less than 1000

You are provided with two database tables – Employee and Bonus – and your goal is to find the names and bonus amounts of employees whose bonus is less than 1000.

📘 Table Structures:

Employee Table

empIdnamesupervisorsalary1John310002Jane312003AliceNULL15004Bob3800

Bonus Table

empIdbonus1800220004500

🛠 Objective:

You want to fetch the name and bonus of employees where the bonus is less than 1000.

To do this, you’ll:

  1. Join the Employee and Bonus tables using the common empId.
  2. Use a WHERE clause to filter only those records where the bonus < 1000.

✅ SQL Query:

sql

SELECT 
    e.name, 
    b.bonus
FROM 
    Employee e
JOIN 
    Bonus b ON e.empId = b.empId
WHERE 
    b.bonus < 1000;

📊 Expected Output:

namebonusJohn800Bob500

💡 Notes:

  • We use an INNER JOIN to combine employee details with their bonus.
  • The filter condition b.bonus < 1000 ensures we only get those employees whose bonus is below the threshold.
  • This kind of query is useful for audits, reward adjustments, or tracking under-incentivized employees.



Comments

No comments yet

Add a new Comment

NUHMAN.COM

Information Technology website for Programming & Development, Web Design & UX/UI, Startups & Innovation, Gadgets & Consumer Tech, Cloud Computing & Enterprise Tech, Cybersecurity, Artificial Intelligence (AI) & Machine Learning (ML), Gaming Technology, Mobile Development, Tech News & Trends, Open Source & Linux, Data Science & Analytics

Categories

Tags

©{" "} Nuhmans.com . All Rights Reserved. Designed by{" "} HTML Codex