From e9a117c085aba2061dccfa92ab45a61f9ad6a38a Mon Sep 17 00:00:00 2001 From: anthonydb Date: Sat, 7 Sep 2024 21:53:30 -0400 Subject: [PATCH] Minor formatting update --- Chapter_13/Chapter_13.sql | 8 -------- Chapter_14/Chapter_14.sql | 2 -- 2 files changed, 10 deletions(-) diff --git a/Chapter_13/Chapter_13.sql b/Chapter_13/Chapter_13.sql index 89a78f0..c115805 100644 --- a/Chapter_13/Chapter_13.sql +++ b/Chapter_13/Chapter_13.sql @@ -201,12 +201,10 @@ WITH (SELECT state_name, sum(pop_est_2018) FROM us_counties_pop_est_2019 GROUP BY state_name), - establishments (st, establishment_count) AS (SELECT st, sum(establishments) AS establishment_count FROM cbp_naics_72_establishments GROUP BY st) - SELECT counties.st, pop_est_2018, establishment_count, @@ -223,7 +221,6 @@ WITH us_median AS (SELECT percentile_cont(.5) WITHIN GROUP (ORDER BY pop_est_2019) AS us_median_pop FROM us_counties_pop_est_2019) - SELECT county_name, state_name AS st, pop_est_2019, @@ -266,12 +263,10 @@ FROM crosstab('SELECT office, FROM ice_cream_survey GROUP BY office, flavor ORDER BY office', - 'SELECT flavor FROM ice_cream_survey GROUP BY flavor ORDER BY flavor') - AS (office text, chocolate bigint, strawberry bigint, @@ -303,10 +298,8 @@ FROM crosstab('SELECT GROUP BY station_name, date_part(''month'', observation_date) ORDER BY station_name', - 'SELECT month FROM generate_series(1,12) month') - AS (station text, jan numeric(3,0), feb numeric(3,0), @@ -349,7 +342,6 @@ WITH temps_collapsed (station_name, max_temperature_group) AS ELSE 'No reading' END FROM temperature_readings) - SELECT station_name, max_temperature_group, count(*) FROM temps_collapsed GROUP BY station_name, max_temperature_group diff --git a/Chapter_14/Chapter_14.sql b/Chapter_14/Chapter_14.sql index cec6fb6..b431f1c 100644 --- a/Chapter_14/Chapter_14.sql +++ b/Chapter_14/Chapter_14.sql @@ -189,7 +189,6 @@ SET date_1 = (regexp_match(original_text, '\/\d{2}\n(\d{4})'))[1] ||' US/Eastern' )::timestamptz, - date_2 = CASE -- 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] ||' US/Eastern' )::timestamptz - -- 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) AND (SELECT regexp_match(original_text, '\/\d{2}\n\d{4}-(\d{4})') IS NOT NULL)