Twelve months and a bonus
- O(1) · Trivial
- Free
- SQL
- operations
- filtering
Problem
In December the company pays a year-end bonus, equal to one month's salary, to anyone who earns less than 3000 a month. At exactly 3000, there's no bonus.
HR wants to know how much each person who gets it will be paid over the whole year: twelve months of salary plus the bonus.
Show the name and that total, in that order.
What it has to return
These rows, in any order
| name | total |
|---|---|
| Rachel | 24700 |
| Nicole | 27300 |
| Frank | 33800 |
| Grace | 31200 |
This is what comes out with the data in the practice database this challenge uses. The column names don’t count, so name yours however you like: what counts is how many there are and the order they come in. Besides this one, the challenge has hidden tests with other data that are revealed when you submit your solution.
You start with this
SQL
SELECT name, salary
FROM employeesIt opens in your browser, with the editor and the tests. It is free and you do not need an account to start.