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

SQL로 시작하는 데이터 분석

by 캐시 타니무라, 박상근
August 2022
Beginner to intermediate
436 pages
9h 43m
Korean
Hanbit Media, Inc.
Content preview from SQL로 시작하는 데이터 분석
203
4
코호트 분석
SELECT
distinct
id_bioguide
,
min
(term_start)
over
(
partition
by
id_bioguide)
as
first_term
,
first_value
(state)
over
(
partition
by
id_bioguide
order
by
term_start)
as
first_state
FROM
legislators_terms
) a
JOIN
legislators b
on
a.id_bioguide = b.id_bioguide
WHERE
a.first_term
between
‘1917-01-01’
and
‘1999-12-31’
GROUP
BY
1,2
) aa
JOIN
(
SELECT
generate_series
as
period
FROM
generate_series(0,20,1)
) cc
on
1 = 1
) aaa
LEFT
JOIN
(
SELECT
d.first_state, g.gender
,
coalesce
(date_part(‘year’,age(f.date,d.first_term)),0)
as
period
,
count
(
distinct
d.id_bioguide)
as
cohort_retained
FROM
(
SELECT
distinct
id_bioguide
,
min
(term_start)
over
(
partition
by
id_bioguide)
as
first_term
,
first_value
(state)
over
(
partition ...
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.
Start your free trial

You might also like

견고한 데이터 엔지니어링

견고한 데이터 엔지니어링

조 라이스, 맷 하우슬리
행동 데이터 분석

행동 데이터 분석

플로랑 뷔송
데이터 과학을 위한 통계(2판)

데이터 과학을 위한 통계(2판)

이준용, 피터 브루스, 앤드루 브루스, 피터 게데크

Publisher Resources

ISBN: 9791169210089