0
SQL UPDATE arithmetic question
In the SQL UPDATE practice exercises, the Pay Raises question asks to update the salary values in the company table for employees with greater than a 5 rating. I need some guidance on the proper formatting for doing arithmetic in SQL queries. My best guess is below, but it does not work: /* UPDATE company SET salary = salary + salary*0.2 WHERE rating > 5; */
8 Respuestas
+ 4
first update then select...
UPDATE company
SET salary = salary + salary*0.2
WHERE rating > 5;
SELECT * FROM company;
+ 1
Can you put the whole question here. So we can help you
+ 1
As it is a pro code coach, so I can't see it.
I think your solution is right and be sure you also give
Select * from company;
command
0
Sure:
Write a query to increase salaries by 20% for those employees whose rating is above 5.
Then show the updated table.
Source: https://sololearn.com/coach/1011/?ref=app
0
Like this?
/*
SELECT * FROM company;
UPDATE company
SET salary = salary + salary*0.2
WHERE rating > 5;
*/
0
UPDATE company
SET salary = salary*1.2
WHERE rating > 5;
SELECT * FROM company;
0
UPDATE company
SET salary = salary + salary*0.2
WHERE rating > 5;
SELECT * FROM company;
0
UPDATE company
SET salary = salary * 1.2
WHERE rating > 5;
SELECT * FROM Company;