Hello All, I need to generate a simple script according to the following: "Using only one update write query to update a salary by 10% for salaries below 100k and 15% for salaries above 100k"
TIA

update employee set salary = salary*(case when salary < 100000 then 1.5 when salary > 100000 1.1 else 1 end);

You can use a CASE ... END stament for address the factor of multiplie salary. And when the salary = 100.000 exactly? Well in this case the factor is 1 (you don`t specified this case).
When the field has a null value, the factor is 1*null=null, all ok.

I know... my level english is very low.

Greetings

PS. Do you need a script in Batch-dos or PL/SQL?

This should work for you.

update employee set salary = case 
          when salary <    100000 then  salary * 1.10
          when salary >=  100000 then  salary * 1.15
End;

Thanks all for the great answers! Dan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.