Skip to main content

Command Palette

Search for a command to run...

LeetCode 577: Employee Bonus

LeetCode 577: Employee Bonus Solution

Updated
1 min read
LeetCode 577: Employee Bonus
V

I'm Varchasv, a Data Engineer working on enterprise data integration.

Currently on a 90-problem challenge to level up my technical skills and switch to a more development-focused role.

What I'm doing:

  • Solving 2 Leetcode problems daily (SQL + DSA).
  • Blogging about each problem.
  • Building in public.

My Goal - Land a better data engineering role by mid-2026.

Follow my journey !!

Date: January 23, 2026
Category: SQL
Time Taken: 2 minutes
Difficulty: Easy


Problem Statement

Write a solution to report the name and bonus amount of each employee who satisfies either of the following:

  • The employee has a bonus less than 1000.

  • The employee did not get any bonus.

Link: Employee Bonus


My Approach

Initial thought:
Since we need the names of employees with no bonuses, we will perform a left join. This will result in null values for employees who have no bonuses.

Final solution:

We will join the Employee and Bonus tables using a left join, focusing on the employee, so we can get the employee names that have no data associated with them, and then we can filter them out using WHERE bonus IS NULL.


Solution Code

SELECT e.name, b.bonus
FROM Employee AS e
LEFT JOIN Bonus AS b
ON e.empId = b.empId
WHERE b.bonus IS NULL OR b.bonus < 1000

Key Takeaway: Nothing that I did not know already.

Pattern: Joins

Mistakes I Made: None, solved it first try

Series: 90 Days of Data Engineering Progress: 17/90 problems completed

Tags: #DEQuest #LeetCode #SQL #DataEngineering #BuildInPublic