CASE in UPDATE Statements (Conditional Data Modification)
CASE in UPDATE Statements (Conditional Data Modification)
UPDATE Employees2
SET Salary =
CASE
WHEN PerformanceRating > 90 THEN Salary * 1.15
WHEN PerformanceRating BETWEEN 75 AND 90 THEN Salary * 1.10
WHEN PerformanceRating BETWEEN 50 AND 74 THEN Salary * 1.05
ELSE Salary
END;
Conditionally increasing salaries based on performance ratings.
37 comments