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; */

11th Mar 2021, 2:18 PM
Anis Ali Khan
8 Respuestas
+ 4
first update then select... UPDATE company SET salary = salary + salary*0.2 WHERE rating > 5; SELECT * FROM company;
12th Mar 2021, 6:29 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
Can you put the whole question here. So we can help you
11th Mar 2021, 2:49 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 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
11th Mar 2021, 3:37 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
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
11th Mar 2021, 2:54 PM
Anis Ali Khan
0
Like this? /* SELECT * FROM company; UPDATE company SET salary = salary + salary*0.2 WHERE rating > 5; */
11th Mar 2021, 4:55 PM
Anis Ali Khan
0
UPDATE company SET salary = salary*1.2 WHERE rating > 5; SELECT * FROM company;
8th Dec 2021, 1:21 AM
Brian Alexander Theodore Olsen
Brian Alexander Theodore Olsen - avatar
0
UPDATE company SET salary = salary + salary*0.2 WHERE rating > 5; SELECT * FROM company;
5th Jan 2022, 12:30 PM
Ibrahim Mohamed Abd El Maksoud
0
UPDATE company SET salary = salary * 1.2 WHERE rating > 5; SELECT * FROM Company;
17th Feb 2022, 9:40 PM
Hassina Ouzia
Hassina Ouzia - avatar