groupby按照某个属性分组
group_concat()按照分组并连接结果
like 相当于contain包含,'%ABB' 模糊搜索
update方法和set是一块的
1484. 按日期分组销售产品
select sell_date,
count(distinct product) as num_sold,
group_concat(distinct product
order by product SEPARATOR ',') as products
from
Activities
group by sell_date
order by sell_date;
1527. 患某种疾病的患者
select * from Patients
where conditions like 'DIAB1%' or conditions like '% DIAB1%'
1667. 修复表中的名字
select user_id,
concat(upper(left(name,1)),lower(substr(name,2)))
as name
from Users
order by user_id;
网友评论