0
SQL update
Please help me to write a query which increase employeeâs salary by 20 percent if only the rating is above 5. I need to use UPDATE operator. Is there any bugs in query below? Update company Set salary = salary* 1.2 Where rating >=5; Or Update company Set salary = salary+(salary*0.2) Where rating>=5; Table name is company
2 Answers
+ 3
YokoS
2nd query is right but rating should be greater than 5 only not equal to 5
UPDATE company SET salary = salary + salary * 0.2 WHERE rating > 5;
SELECT * FROM company
+ 1
Thank you for advising me. I got it :)