Mysql每日一题(if函数)
两种写法if()和case
if()函数
select *,if(T.x+T.y>T.z and T.x+T.z>T.y and T.y+T.z>T.x,'Yes','No') as 'triangle'
from Triangle as T;
case方法
select *, case
when T.x+T.y>T.z and T.x+T.z>T.y and T.y+T.z>T.x then 'Yes'
else 'No' end as 'triangle'
from Triangle as T;