How to order sql results starting with a certain string How to order sql results starting with a certain string sql sql

How to order sql results starting with a certain string


select animal_name from animal where animal_name like '%cat%' --test if name contains catorder by case when animal_name like 'cat%' then 0 else 1 end, -- order with name starting with cat first animal_name -- then by name

see SqlFiddle