LeetCode 高频 SQL 50 题(基础版)之 【高级字符串函数 / 正则表达式 / 子句】· 下
上部分:LeetCode 高频 SQL 50 题(基础版)之 【高级字符串函数 / 正则表达式 / 子句】· 上
题目:1484. 按日期分组销售产品
题解:
select sell_date , count(distinct product) num_sold ,
group_concat(distinct product order by product asc separator ',') products
from Activities
group by sell_date
order by sell_date
题目:1327. 列出指定时间段内所有的下单产品
题解:
select p.product_name, t.unit unit from
Products p right join(select product_id , sum(unit) unit from Orderswhere order_date>='2020-02-01' and order_date<='2020-02-29'group by product_idhaving sum(unit)>=100
) t on t.product_id=p.product_id
题目:1517. 查找拥有有效邮箱的用户
题解:MySQL中【正则表达式】用法
select * from Users
where mail regexp '^[a-zA-Z][a-zA-Z0-9\_\\.\-]*@leetcode\\.com$'