Chapter 13 revisions per tech review
This commit is contained in:
parent
00c744cb65
commit
748528c617
@ -168,7 +168,8 @@ LEFT JOIN LATERAL (SELECT *
|
|||||||
WHERE teacher_id = t.id
|
WHERE teacher_id = t.id
|
||||||
ORDER BY access_time DESC
|
ORDER BY access_time DESC
|
||||||
LIMIT 2) a
|
LIMIT 2) a
|
||||||
ON true;
|
ON true
|
||||||
|
ORDER BY t.id;
|
||||||
|
|
||||||
-- Common Table Expressions
|
-- Common Table Expressions
|
||||||
|
|
||||||
@ -252,6 +253,7 @@ WITH (FORMAT CSV, HEADER);
|
|||||||
-- view the data
|
-- view the data
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM ice_cream_survey
|
FROM ice_cream_survey
|
||||||
|
ORDER BY response_id
|
||||||
LIMIT 5;
|
LIMIT 5;
|
||||||
|
|
||||||
-- Listing 13-17: Generating the ice cream survey crosstab
|
-- Listing 13-17: Generating the ice cream survey crosstab
|
||||||
@ -293,7 +295,7 @@ WITH (FORMAT CSV, HEADER);
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM crosstab('SELECT
|
FROM crosstab('SELECT
|
||||||
station_name,
|
station_name,
|
||||||
date_part(''month'', observation_date),
|
date_part($$month$$, observation_date),
|
||||||
percentile_cont(.5)
|
percentile_cont(.5)
|
||||||
WITHIN GROUP (ORDER BY max_temp)
|
WITHIN GROUP (ORDER BY max_temp)
|
||||||
FROM temperature_readings
|
FROM temperature_readings
|
||||||
@ -350,19 +352,3 @@ 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
|
||||||
ORDER BY station_name, count(*) DESC;
|
ORDER BY station_name, count(*) DESC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- UNUSED
|
|
||||||
SELECT county_name,
|
|
||||||
state_name,
|
|
||||||
pop_est_2019,
|
|
||||||
natural_chg,
|
|
||||||
net_migration,
|
|
||||||
natural_chg + net_migration AS total_chg
|
|
||||||
FROM us_counties_pop_est_2019,
|
|
||||||
LATERAL (SELECT births_2019 - deaths_2019 AS natural_chg) AS nc,
|
|
||||||
LATERAL (SELECT international_migr_2019 + domestic_migr_2019 AS net_migration) AS nm
|
|
||||||
WHERE (net_migration > 0 AND natural_chg < 0)
|
|
||||||
AND (abs(net_migration) > abs(natural_chg))
|
|
||||||
ORDER BY total_chg DESC;
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user