[TIL#38 250415] 소원을 들어줘요 지니요정

강민지·2025년 4월 15일

데이터분석_TIL

목록 보기
41/81

Daily plan

🌞오전

- SQL 코드카타 104, 105, 106번 ✅
- 10시 머신러닝 라이브세션 ✅

🔥 오후

- 머신러닝 강의 다 듣고 정리 ✅
- 시간 남으면 실습도!!

🌝 저녁

- TIL 제출해 !!!! ✅

이번주 목표

  • 머신러닝 강의 완강
  • 라이브세션 정리&복습 밀리지 않기!
  • 파이썬 스탠다드반 정리&복습 밀리지 않기!
  • SQL 코드카타 하루 3문제 이상

SQL 코드카타

Q104 - Biggest Single Number

select max(num) as num
from (select num
      from mynumbers
      group by num
      having count(1)=1) a

Q105 - Customers Who Bought All Products

select customer_id
from(
    select customer_id, count(distinct product_key) cnt
    from customer
    group by customer_id
)a
where cnt = (select count(*) from product)

Having절을 사용해도 좋을 듯

select customer_id
from customer
group by customer_id
having count(distinct product_key) = (select count(*) from product)

Q106 - The Number Of Employees Which Report To Each Employee

select e1.employee_id, 
	e1.name, 
	count(e2.employee_id) as reports_count, 
    round(avg(e2.age)) as average_age
from employees e1
    join employees e2
    on e1.employee_id = e2.reports_to
# where e1.employee_id = e2.reports_to
group by e1.employee_id
order by e1.employee_id

where절에 작성한 조건이 이미 join on에서 적용되므로 where절을 삭제해도 될 것 같다.


머신러닝 강의

머신러닝 강의 이론 정리

드디어 이론 정리 끝냈다........
내일부터 빨리 실습 해봐야지ㅜㅜ


일기


지니데이

1개의 댓글

comment-user-thumbnail
2025년 4월 15일

공부 열심히 했군..

답글 달기