SQL知识点:条件判断用法(case when和if)

条件判断

点击查看代码
# 使用case when
/*
select
    x,y,z,
    case
        when x+y>z and x+z>y and y+z>x then 'Yes' else 'No'
    end as triangle
from
    triangle
*/
# 使用if
select
    x,y,z,
    if(x+y>z and x+z>y and y+z>x,'Yes','No') AS triangle
from
    triangle

posted @ 2025-02-26 11:35  测试三思  阅读(32)  评论(0)    收藏  举报