Pay With Bonus
bonus is empty (NULL) for people who got none. Return everyone's name and pay: salary plus bonus, where no bonus counts as 0. Rows may come in any order.
Example 1
employees
| id | name | salary | bonus |
|---|---|---|---|
| 1 | Ada | 5000 | 400 |
| 2 | Ben | 4200 | NULL |
| 3 | Cy | 3900 | 0 |
returns
| name | pay |
|---|---|
| Ada | 5400 |
| Ben | 4200 |
| Cy | 3900 |
Constraints
- Up to 12 people
Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.
More SQL problems
- Small, Medium, LargeEasy
- Total per SymbolEasy
- Totals by MonthEasy
- Above the AverageMedium
- Best Paid in Each DepartmentMedium
- Bought but Never SoldMedium
- Change From the Day BeforeMedium
- First OrderMedium