1757. Recyclable and Low Fat Products (Easy)
# Write your MySQL query statement below
select product_id
from Products
where low_fats = 'Y' and recyclable = 'Y';
1445. Apples & Oranges (Medium)
# Write your MySQL query statement below
select A.sale_date, (A.sold_num - B.sold_num) as 'diff'
from (select *
from Sales
where fruit = 'apples') as A
join
(select *
from Sales
where fruit = 'oranges') as B
on A.sale_date = B.sale_date;
597. Friend Requests I: Overall Acceptance Rate (Easy)
# Write your MySQL query statement below
select ifnull(round(
count(distinct requester_id, accepter_id)/
(select count(distinct sender_id, send_to_id) from FriendRequest), 2)
, 0)
as 'accept_rate'
from RequestAccepted;
'코딩 연습 > SQL' 카테고리의 다른 글
[leetcode] 262 ~ 569 (0) | 2022.04.13 |
---|---|
[leetcode] 175 ~ 197 (0) | 2022.04.04 |
Intro to SQL (0) | 2022.01.04 |
우유와 요거트가 담긴 장바구니 (0) | 2021.07.05 |
[Hacker Rank] Weather Observation Station 20 (0) | 2021.04.05 |