실습문제를 풀면서 몰랐던 부분을 새로 정리해보자

17번
select name
from team_projects
where aws_cost>=40000
18번
select *
from team_projects
where Year(start_date)=2022
19번
select *
from team_projects
where curedate() between start_date and end_date
20번
select *,
datediff(end_date, start_date) working_days
from team_projects

21번
select name,
rating,
rank() over(order by rating desc) rank
from lol_users
22번
select name
from lol_users
order by join_date desc
limit 1
23번
select *
from lol_users
order by region,
rating desc
24번
select region,
avg(rating) avg_rating
from lol_users
group by region

25번
select *
from lol_feedbacks
order by satisfaction_score desc
26번
select *,
max(feedback_date)
from lol_feedbacks
group by user_name
27번
select count(*)
from lol_feedbacks
where satisfaction_score=5
select ,
count(1)
from lol_feedbacks
where satisfaction_score=5
이렇게 오답을 작성했는데,

해당 조건의 데이터는 총 100개이다.

제일 위의 데이터 하나와 count함수가 나오게 된다. 틀린 건 아니지만 혼란을 줄이기 위해서는 count()만 입력한다.

28번
select user_name,
count(1) cnt_feedbacks
from lol_feedbacks
group by user_name
order by cnt_feedbacks desc
limit 3
29번
select feedback_date,
avg(satisfaction_score) avg_satisfaction_score
from lol_feedbacks
group by feedback_date
order by avg_satisfaction_score desc
limit 1