sql语句们

2017-08-21  本文已影响21人  wshxj123

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

1. UPDATE CASE...WHEN...

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

2. MOD DESC

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

3. Group by Having

select Email
from Person
group by Email
having count(Email) > 1;
上一篇 下一篇

猜你喜欢

热点阅读