데이터 분석_그로스 해킹
자세히보기

SQL/Programmers 13

Programmers - 자동차 대여 기록에서 대여중 / 대여 가능 여부 구분하기(67%)

참고 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/157340 C> Q> H> - left 함수 사용 - 날짜 between start_date and end_date L&U> - 날짜를 between 에 넣어서 활용할 수 있는 접근이 기억에 남았다 - 테이블 조인을 활용해 null 값을 도출하는 과정이 인상 깊었다. U: 이벤트 날짜가 구매 날짜에 걸리냐 안걸리냐에 따라서 userid 추출이 가능할 것 같다. A> with t1 as ( SELECT distinct car_id as car_id from car_rental_company_rental_history order by 1 desc ) , t2 as ( select car_i..

SQL/Programmers 2023.02.19

Programmers - 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기(55%)

참고 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/151139 C> Q> H> - Having 함수 사용 - 22년 8월 부터 22년 10월까지 총 대여 횟수가 5회 이상 A> with t1 as ( select month(start_date) as month , car_id , count(*) as records from CAR_RENTAL_COMPANY_RENTAL_HISTORY where month(start_date) >= 8 and month(start_date) =5 ) order by 1, 2 desc L> having 함수를 group by 안에 쓰냐, 바깥에 쓰느냐에 따라서 월 별 5회 이상인지, 3개월 동안 5회 이상인..

SQL/Programmers 2023.02.18

Promrammers - 자동차 대여 기록 별 대여 금액 구하기(29%)

참고링크 : https://school.programmers.co.kr/learn/courses/30/lessons/151141 https://velog.io/@crosstar1228/SQL-join%ED%95%A0%EB%95%8C-on-%EA%B3%BC-where%EC%9D%98-%EC%B0%A8%EC%9D%B4 C> Q> H> - case when 함수 활용 - ifnull 함수 활용 - datediff 함수 활용 - left join 후, and 조건 및 where 조건 차이에 대한 의사 결정 - left join 후 where 조건이 아닌 and 조건을 적용을 통해 값을 살려놓아야 한다. 그렇지 않으면 7일 미만의 정확한 대여금액은 빠지게 된다. A> A1> cube1477 님 쿼리 참고 : 공부..

SQL/Programmers 2023.02.18