摘要: leetcode 1393 股票的资本损益 select p1.stock_name, (p2.price - p1.price) as capital_gain_loss from ( select s1.stock_name, s1.operation, sum(s1.price) as pri 阅读全文
posted @ 2023-06-02 15:54 Carl_ZhangJH 阅读(11) 评论(0) 推荐(0) 编辑
摘要: leetcode 1341 电影评分 ( select u1.name as results from Users u1 left join( select mr1.user_id, count(mr1.rating) as c1 from MovieRating as mr1 group by m 阅读全文
posted @ 2023-06-02 12:05 Carl_ZhangJH 阅读(10) 评论(0) 推荐(0) 编辑
摘要: leetcode 1321 餐館營業額變化增長 select distinct c2.visited_on, (select sum(amount) from Customer c1 where c1.visited_on <= c2.visited_on and c1.visited_on >= 阅读全文
posted @ 2023-05-17 11:03 Carl_ZhangJH 阅读(26) 评论(0) 推荐(0) 编辑
摘要: leetcode 1193 每月交易 I select t2.month, t1.country, count(t1.country) as trans_count, sum(t1.state = 'approved') as approved_count, sum(t1.amount) as tr 阅读全文
posted @ 2023-05-16 14:42 Carl_ZhangJH 阅读(9) 评论(0) 推荐(0) 编辑
摘要: select p1.product_id, ifnull(p2.new_price,10) as price from ( select distinct product_id from Products ) p1 left join ( select product_id, new_price f 阅读全文
posted @ 2023-05-15 17:56 Carl_ZhangJH 阅读(9) 评论(0) 推荐(0) 编辑
摘要: leetcode 1158 市場分析I select uo.user_id as buyer_id, uo.join_date, if(uo.buyer_id, uo.c, 0) as orders_in_2019 from ( select u.user_id, u.join_date, o.bu 阅读全文
posted @ 2023-05-12 17:04 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0) 编辑
摘要: leetcode 1211 查詢結果的質量和佔比 select query_name,round( sum(rating / position) / count(result) , 2) as quality ,round(sum(rating < 3) / count(result) * 100, 阅读全文
posted @ 2023-05-12 15:04 Carl_ZhangJH 阅读(5) 评论(0) 推荐(0) 编辑
摘要: leetcode 1251 平均售價 select r.product_id, round(sum(r.price * r.units) / sum(r.units), 2) as average_price from ( select p.product_id, p.price , u.units 阅读全文
posted @ 2023-05-12 12:32 Carl_ZhangJH 阅读(6) 评论(0) 推荐(0) 编辑
摘要: leetcode 1280 學生們參加各科測試的次數 select s.student_id, s.student_name, st.subject_name, if(e.result, e.result, 0) as attended_exams from Students s join Subj 阅读全文
posted @ 2023-05-12 10:41 Carl_ZhangJH 阅读(6) 评论(0) 推荐(0) 编辑
摘要: leetcode 1148 文章瀏覽I select distinct author_id as id from Views where author_id = viewer_id order by author_id == 阅读全文
posted @ 2023-05-12 10:15 Carl_ZhangJH 阅读(15) 评论(0) 推荐(0) 编辑