Oracle SQL provides the CASE
statement as a powerful tool for performing conditional logic in queries. This allows users to conduct multiple comparisons and derive new values based on specified conditions. For example:
sqlCopy codeSELECT employee_id,
CASE
WHEN salary < 3000 THEN 'Low'
WHEN salary BETWEEN 3000 AND 6000 THEN 'Medium'
ELSE 'High'
END AS salary_category
FROM employees;
Leave a Reply