摘要: leetcode 1141 查詢進30天活躍用戶數 select activity_date as day , count(distinct user_id) as active_users from Activity a where activity_date between DATE_SUB(' 阅读全文
posted @ 2023-05-12 09:56 Carl_ZhangJH 阅读(23) 评论(0) 推荐(0)
摘要: leetcode 1084 销售分析III select distinct p.product_id, p.product_name from Product p left join Sales s on p.product_id = s.product_id where s.product_id 阅读全文
posted @ 2023-05-11 17:59 Carl_ZhangJH 阅读(18) 评论(0) 推荐(0)
摘要: leetcode 1050 合作过至少三次的演员和导演 select actor_id, director_id from ActorDirector group by actor_id, director_id having count(*) >= 3 == 阅读全文
posted @ 2023-05-11 17:23 Carl_ZhangJH 阅读(18) 评论(0) 推荐(0)
摘要: leetcode 1045 买下所有产品的客户 select customer_id from Customer c left join Product p on c.product_key = p.product_key group by customer_id having count(dist 阅读全文
posted @ 2023-05-11 17:05 Carl_ZhangJH 阅读(13) 评论(0) 推荐(0)
摘要: update `Salary` set sex = if(sex = 'f','m','f') update Salary set sex=( case when sex='m' then 'f' else 'm' end ) 阅读全文
posted @ 2023-05-10 16:40 Carl_ZhangJH 阅读(10) 评论(0) 推荐(0)
摘要: leetcode 626 換座位 SELECT (CASE WHEN MOD(id, 2) != 0 AND counts != id THEN id + 1 WHEN MOD(id, 2) != 0 AND counts = id THEN id ELSE id - 1 END) AS id, s 阅读全文
posted @ 2023-05-09 17:57 Carl_ZhangJH 阅读(18) 评论(0) 推荐(0)
摘要: leetcode 619 只出現一次的最大數字 select max(num) as num from ( select num as num from MyNumbers group by num having count(num) = 1 ) as mn select if(count(num) 阅读全文
posted @ 2023-05-09 17:57 Carl_ZhangJH 阅读(20) 评论(0) 推荐(0)
摘要: 樹節點 select id, 'Root' as Type from tree where p_id is null union select id, 'Inner' as Type from tree where id in ( select distinct p_id from tree whe 阅读全文
posted @ 2023-04-27 10:31 Carl_ZhangJH 阅读(16) 评论(0) 推荐(0)
摘要: 銷售員 select s.`name` from salesperson s left join orders o on s.sales_id=o.sales_id left join company c on o.com_id=c.com_id and c.name='RED' group by 阅读全文
posted @ 2023-04-25 17:19 Carl_ZhangJH 阅读(13) 评论(0) 推荐(0)
摘要: 大的國家 select `name`, population, area from World where area >= 3000000 or population >= 25000000 阅读全文
posted @ 2023-04-25 15:55 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)