The Calculate Special Bonus interview question is a SQL task that requires conditional logic. You are given an Employees table with columns employee_id, name, and salary. A special bonus is awarded to an employee if:
Google uses this to check a candidate's familiarity with SQL's CASE statement or IF function. It also tests your knowledge of string pattern matching (LIKE) and basic arithmetic operators (% for modulo). It's a fundamental test of whether you can translate business logic into a database query.
This follows the Database interview pattern. You use a SELECT statement with a CASE WHEN clause to evaluate the conditions.
Employees:
Practice using CASE WHEN ... THEN ... ELSE ... END. It is the most versatile way to implement complex branching logic within a SQL query. Also, remember that name NOT LIKE 'M%' is equivalent to LEFT(name, 1) != 'M'.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Calculate Compressed Mean | Easy | Solve | |
| Find Customers With Positive Revenue this Year | Easy | Solve | |
| Find Expensive Cities | Easy | Solve | |
| Loan Types | Easy | Solve | |
| The Latest Login in 2020 | Easy | Solve |