Skip to the content

One raise, not two

Problem

This year's raise goes by bracket, and the bracket goes by monthly salary: 10% for anyone who earns less than 2500, and 5% for anyone who earns 2500 or more but less than 3500. From 3500 up there's no raise, so Carol and the managers stay where they are.

What sets the bracket is today's salary, the one from before anything gets touched, and nobody gets both raises.

Write the change. Every salary ends in 00, so no raise leaves decimals. It's graded by looking at where every salary in the company ends up.

What it has to return

After your code, this query runs

SELECT id, name, salary FROM employees;

These rows, in any order

idnamesalary
1Carol5200
2Mark3800
3Paige4100
4Rachel2090
5Nicole2310
6Samuel3150
7Lydia3150
8Frank2730
9Grace2640

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

UPDATE employees
SET salary = salary * 1.1
WHERE salary < 2500;
Solve this challenge

It opens in your browser, with the editor and the tests. This challenge is part of the full plan; the O(1) and O(log n) ones are free.

More O(n²) challenges

See all challenges →