Minor formatting update

This commit is contained in:
anthonydb 2024-09-07 21:53:30 -04:00
parent 5b2032536b
commit e9a117c085
2 changed files with 0 additions and 10 deletions

View File

@ -201,12 +201,10 @@ WITH
(SELECT state_name, sum(pop_est_2018) (SELECT state_name, sum(pop_est_2018)
FROM us_counties_pop_est_2019 FROM us_counties_pop_est_2019
GROUP BY state_name), GROUP BY state_name),
establishments (st, establishment_count) AS establishments (st, establishment_count) AS
(SELECT st, sum(establishments) AS establishment_count (SELECT st, sum(establishments) AS establishment_count
FROM cbp_naics_72_establishments FROM cbp_naics_72_establishments
GROUP BY st) GROUP BY st)
SELECT counties.st, SELECT counties.st,
pop_est_2018, pop_est_2018,
establishment_count, establishment_count,
@ -223,7 +221,6 @@ WITH us_median AS
(SELECT percentile_cont(.5) (SELECT percentile_cont(.5)
WITHIN GROUP (ORDER BY pop_est_2019) AS us_median_pop WITHIN GROUP (ORDER BY pop_est_2019) AS us_median_pop
FROM us_counties_pop_est_2019) FROM us_counties_pop_est_2019)
SELECT county_name, SELECT county_name,
state_name AS st, state_name AS st,
pop_est_2019, pop_est_2019,
@ -266,12 +263,10 @@ FROM crosstab('SELECT office,
FROM ice_cream_survey FROM ice_cream_survey
GROUP BY office, flavor GROUP BY office, flavor
ORDER BY office', ORDER BY office',
'SELECT flavor 'SELECT flavor
FROM ice_cream_survey FROM ice_cream_survey
GROUP BY flavor GROUP BY flavor
ORDER BY flavor') ORDER BY flavor')
AS (office text, AS (office text,
chocolate bigint, chocolate bigint,
strawberry bigint, strawberry bigint,
@ -303,10 +298,8 @@ FROM crosstab('SELECT
GROUP BY station_name, GROUP BY station_name,
date_part(''month'', observation_date) date_part(''month'', observation_date)
ORDER BY station_name', ORDER BY station_name',
'SELECT month 'SELECT month
FROM generate_series(1,12) month') FROM generate_series(1,12) month')
AS (station text, AS (station text,
jan numeric(3,0), jan numeric(3,0),
feb numeric(3,0), feb numeric(3,0),
@ -349,7 +342,6 @@ WITH temps_collapsed (station_name, max_temperature_group) AS
ELSE 'No reading' ELSE 'No reading'
END END
FROM temperature_readings) FROM temperature_readings)
SELECT station_name, max_temperature_group, count(*) SELECT station_name, max_temperature_group, count(*)
FROM temps_collapsed FROM temps_collapsed
GROUP BY station_name, max_temperature_group GROUP BY station_name, max_temperature_group

View File

@ -189,7 +189,6 @@ SET date_1 =
(regexp_match(original_text, '\/\d{2}\n(\d{4})'))[1] (regexp_match(original_text, '\/\d{2}\n(\d{4})'))[1]
||' US/Eastern' ||' US/Eastern'
)::timestamptz, )::timestamptz,
date_2 = date_2 =
CASE CASE
-- if there is no second date but there is a second hour -- if there is no second date but there is a second hour
@ -201,7 +200,6 @@ SET date_1 =
(regexp_match(original_text, '\/\d{2}\n\d{4}-(\d{4})'))[1] (regexp_match(original_text, '\/\d{2}\n\d{4}-(\d{4})'))[1]
||' US/Eastern' ||' US/Eastern'
)::timestamptz )::timestamptz
-- if there is both a second date and second hour -- if there is both a second date and second hour
WHEN (SELECT regexp_match(original_text, '-(\d{1,2}\/\d{1,2}\/\d{2})') IS NOT NULL) WHEN (SELECT regexp_match(original_text, '-(\d{1,2}\/\d{1,2}\/\d{2})') IS NOT NULL)
AND (SELECT regexp_match(original_text, '\/\d{2}\n\d{4}-(\d{4})') IS NOT NULL) AND (SELECT regexp_match(original_text, '\/\d{2}\n\d{4}-(\d{4})') IS NOT NULL)