sql语句们

发现leetcode上面也有sql题目,把免费的刷一刷总结下

1. UPDATE CASE…WHEN…

《sql语句们》

UPDATE salary
SET
    sex = CASE sex
        WHEN 'm' THEN 'f'
        ELSE 'm'
    END;

2. MOD DESC

《sql语句们》

select *
from cinema
where mod(id, 2) = 1 and description != 'boring'
order by rating DESC
;

3. Group by Having

《sql语句们》

select Email
from Person
group by Email
having count(Email) > 1;
    原文作者:c4bde6d56c1c
    原文地址: https://www.jianshu.com/p/8164b385be74
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞