Skip to Content
SQL로 시작하는 데이터 분석
book

SQL로 시작하는 데이터 분석

by 캐시 타니무라, 박상근
August 2022
Beginner to intermediate
436 pages
9h 43m
Korean
Hanbit Media, Inc.
Content preview from SQL로 시작하는 데이터 분석
82
SQL로 시작하는 데이터 분석
그림
2-3
날짜 차원 테이블과 날짜 속성
Postgres
데이터베이스에서 날짜 차원 테이블을 생성하려면 특정 범위의 시리즈 값을 생성하
generate
_
series
함수를 다음과 같이 사용합니다.
generate_series(
start
,
stop
, step interval)
start
로 생성하고 싶은 날짜 리스트의 처음 날짜,
stop
으로 마지막 날짜,
step
interval
날짜 리스트의 구간 크기를 사용합니다.
step
interval
로 어떤 값이든 사용할 수 있지만, 날
짜 차원 테이블을 만들 때는 하루 단위를 사용하면 좋습니다.
SELECT
*
FROM
generate_series(‘2000-01-01’::
timestamp
,’2030-12-31’, ‘1 day’)
generate
_
series
함수로 날짜 차원 테이블을 생성하려면 최소 하나의 인자는
TIMESTAMP
입이어야 하므로, 문자열
2000
-
01
-
01
의 값을
TIMESTAMP
타입으로 변환해 인자로 사용했
습니다. 이 함수로 생성한 날짜 차원 테이블을 활용하면 모든 날짜별로 고객의 주문 내역을 확
인하는 쿼리를 작성할 수 있습니다. 이 방법은 날짜별 주문 고객 수를 세거나 고객이 구매하지
않은 날을 분석할 때도 유용합니다.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

행동 데이터 분석

행동 데이터 분석

플로랑 뷔송
견고한 데이터 엔지니어링

견고한 데이터 엔지니어링

조 라이스, 맷 하우슬리
파이썬으로 살펴보는 아키텍처 패턴

파이썬으로 살펴보는 아키텍처 패턴

오현석, 해리 퍼시벌, 밥 그레고리
실무로 통하는 클린 코드

실무로 통하는 클린 코드

막시밀리아노 콘티에리

Publisher Resources

ISBN: 9791169210089