Employee Bonus
You can use a LEFT JOIN
between the Employee and Bonus tables to include all employees, even those without a bonus, and then apply a filter to show only the employees with a bonus less than 1000 or no bonus at all.
Here’s the query:
|
|
Explanation:
- The
LEFT JOIN
operation combines the Employee and Bonus tables on theempId
column, including all employees even if they don’t have a corresponding entry in the Bonus table. - The
WHERE
clause filters the results to include only rows where the bonus is less than 1000 or is null, meaning the employee does not have a bonus.