red-4 / curious-moon

The Repository for the book, A Curious Moon, which you can purchase from https://bigmachine.io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chapter Ring Dust - issue with sql

robertlyson opened this issue · comments

On page 192 in "refactor part1: a better cte" subchapter materialized view flyby_altitudes is created

image

It doesn't work .. but it's fine, here is the fixed version:

drop materialized view if exists flyby_altitudes; 
create materialized view flyby_altitudes as 
select   
	(sclk::timestamp) as time_stamp,
	date_part(‘year’, (sclk::timestamp)) as year,
	date_part(‘week’, (sclk::timestamp)) as week,
	alt_t::numeric(10,3) as altitude 
from import.inms 
where target=’ENCELADUS’ and alt_t IS NOT NULL;

Hope that helps!

PS: this book is ...

image

Ah, now I understand

Sorry, little journal, the formatting for this SQL isn’t the best.
:)