How you can you sort the table rows based on the column values based on the condition?
Means not ascending or descending order directly. what-if we want to order rows based on table column values based on our custom requirement.
To achieve the same, we can use CASE expression in an ORDER BY clause to determine the sort order of the rows based on a given column value.
SELECT * FROM Customers
ORDER BY case when country = ‘P’ then 1
when country = ‘A’ then 2
when country = ‘L’ then 3
when country = ‘H’ then 4
Hope this will help !!!