You can establish predetermined values for a column when using the select statement by using the "CASE" statement:
SELECT column1, column2, CASE WHEN column3 >= 10 THEN 'High' WHEN column3 >= 5 THEN 'Medium' ELSE 'Low' END AS 'Priority' FROM table_name;
In this example, the values in column3 are evaluated and a new column (Priority) is created with predetermined values based on the criteria in the CASE statement.
Asked: 2023-06-19 07:13:58 +0000
Seen: 11 times
Last updated: Jun 19 '23