💥 CODEKATA
~45문제
오늘은 임팩트 있는 문제가 없음
just 기록용으로 기재
SELECT ai.animal_id, ai.name
from animal_ins ai left join animal_outs ao on ai.animal_id = ao.animal_id
order by (date(ao.datetime) - date(ai.datetime)) desc limit 2
select a.animal_id, a.animal_type, a.name
from (
SELECT ai.animal_id, ai.animal_type, ai.name, ai.sex_upon_intake, ao.sex_upon_outcome,
ai.sex_upon_intake != ao.sex_upon_outcome as new_sex_upon
from animal_ins ai left join animal_outs ao on ai.animal_id = ao.animal_id
) a
where a.new_sex_upon = 1
SELECT b.book_id, a.author_name, substr(b.published_date, 1, 10) as published_date
from book b left join author a on b.author_id = a.author_id
where category = '경제'
order by b.published_date
SELECT order_id, product_id, substr(out_date, 1, 10) as out_date, case
when out_date <= '2022-05-01' then "출고완료"
when out_date > '2022-05-01' then "출고대기"
else "출고미정" end "출고여부"
from food_order
order by order_id
SELECT ii.ingredient_type, sum(fh.total_order)
from first_half fh left join icecream_info ii on fh.flavor = ii.flavor
group by ii.ingredient_type
SELECT animal_id, name, sex_upon_intake
from animal_ins
where name in ("Lucy", "Ella", "Pickle", "Rogan", "Sabrina", "Mitty")
order by animal_id
SELECT book_id, substr(published_date, 1, 10) as published_date
from book
where category = "인문" and published_date like "2021%"
order by published_date
SELECT round(avg(daily_fee),0) as average_fee
from car_rental_company_car
where car_type = "SUV"
group by car_type
SELECT ub.writer_id as user_id, uu.nickname, sum(ub.price) as total_sales
from used_goods_board ub left join used_goods_user uu on ub.writer_id = uu.user_id
where ub.status = 'DONE'
group by uu.nickname
having total_sales >= 700000
order by total_sales
SELECT case
when price between 0 and 9999 then '0'
when price between 10000 and 19999 then '10000'
when price between 20000 and 29999 then '20000'
when price between 30000 and 39999 then '30000'
when price between 40000 and 49999 then '40000'
when price between 50000 and 59999 then '50000'
when price between 60000 and 69999 then '60000'
when price between 70000 and 79999 then '70000'
when price between 80000 and 89999 then '80000'
when price between 90000 and 99999 then '90000'
end price_group
, count(1) as products
from product
group by price_group
order by price_group
SELECT member_id, member_name, gender, substr(date_of_birth, 1, 10) as date_of_birth
from member_profile
where gender = 'W' and date_of_birth like '%-03-%' and tlno is not null
order by member_id
'Sparta > CODEKATA' 카테고리의 다른 글
| [250821] 스파르타코딩 본캠프 13일차 (2) (0) | 2025.08.21 |
|---|---|
| [250820] 스파르타코딩 본캠프 12일차 (2) (0) | 2025.08.20 |
| [250818] 스파르타코딩 본캠프 10일차 (2) (4) | 2025.08.18 |
| [250814] 스파르타코딩 본캠프 9일차 (2) (4) | 2025.08.14 |
| [250813] 스파르타코딩 본캠프 8일차 (4) | 2025.08.13 |