Fix data using CASE

Fix data using CASE

Hard SQL DML 17 views
Explanation Complexity

Problem Statement

In Employees, if salary is null set to 25000, if salary < 15000 set to 15000, else keep as is. Write one update statement.

Input Format

SQL DML

Output Format

DML statement(s)

Example

Employees(salary)
Salaries normalized

Constraints

None

Input / Output Format

Input Format
SQL DML
Output Format
DML statement(s)
Constraints
None

Examples

Input:
Employees(salary)
Output:
Salaries normalized

Example Solution (Public)

SQL
UPDATE Employees SET salary = CASE WHEN salary IS NULL THEN 25000 WHEN salary < 15000 THEN 15000 ELSE salary END;

Official Solution Code

UPDATE Employees SET salary = CASE WHEN salary IS NULL THEN 25000 WHEN salary < 15000 THEN 15000 ELSE salary END;
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.