Skip to the content

Twelve months and a bonus

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

nametotal
Rachel24700
Nicole27300
Frank33800
Grace31200

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 employees
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →