menu
In PostgreSQL, you can use the CASE expression with the WHEN, THEN, and END keywords within a SELECT statement to perform conditional logic and return different values based on specific conditions. The CASE expression allows you to create conditional branching within your SQL queries. 

Example:
 
Suppose you have a table "employees" with a column salary, and you want to categorize employees into salary ranges

SELECT 
 employee_name, 
 salary, 
 CASE 
 WHEN salary < 30000 THEN 'Low Income' 
 WHEN salary >= 30000 AND salary < 60000 THEN 'Medium Income' 
 WHEN salary >= 60000 THEN 'High Income' 
 ELSE 'Unknown' 
 END AS income_category 
FROM 
 employees;