如何从某个字符串开始命令sql结果

Rix*_*xin 6 sql sql-order-by

我是SQL的新手,我真的需要你的帮助,谢谢你提前:)

我正在使用SQL从表(动物)中选择一个列(animal_name),其内容包含某个字符串(例如'cat'),示例结果:

mycat, hercat, catKitty, catLili, acata, bcatb
Run Code Online (Sandbox Code Playgroud)

现在我希望结果首先显示以'cat'开头的字符串,然后显示剩余的字符串ASC,我想要的样本结果:

catKitty, catLili, acata, bcatb, hercat, mycat
Run Code Online (Sandbox Code Playgroud)

现在我只知道如何使用LIKE选择包含'cat'的结果:

select animal_name from animal where animal_name like '%cat%';
Run Code Online (Sandbox Code Playgroud)

但我不知道如何按结果排序.你能提一些建议吗?再次感谢 :)

Rap*_*aus 10

select animal_name 
from animal 
where animal_name like '%cat%' --test if name contains cat
order by
 case when animal_name like 'cat%' then 0 else 1 end, -- order with name starting with cat first
 animal_name -- then by name
Run Code Online (Sandbox Code Playgroud)

看到SqlFiddle