From ed7d0bab457b06b1bc412b05798be18db8c2a55d Mon Sep 17 00:00:00 2001 From: upsideon <65986739+upsideon@users.noreply.github.com> Date: Tue, 23 Dec 2025 16:40:38 -0700 Subject: [PATCH] Fixing a typo and adding an alternative answer to Chapter 6 exercises. --- Try_It_Yourself/Try_It_Yourself.sql | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Try_It_Yourself/Try_It_Yourself.sql b/Try_It_Yourself/Try_It_Yourself.sql index c0f599c..eda759a 100644 --- a/Try_It_Yourself/Try_It_Yourself.sql +++ b/Try_It_Yourself/Try_It_Yourself.sql @@ -296,7 +296,7 @@ GROUP BY state_us_abbreviation; -- 3,141. That reflects the ongoing adjustments to county-level geographies that -- typically result from government decision making. Using appropriate joins and -- the NULL value, identify which counties don't exist in both tables. For fun, --- search online to nd out why they’re missing +-- search online to find out why they’re missing. -- Answers: @@ -323,6 +323,18 @@ ON c2010.state_fips = c2000.state_fips AND c2010.county_fips = c2000.county_fips WHERE c2010.geo_name IS NULL; +-- Counties that exist in either the 2000 data or the 2010 data, but not both, +-- can also be retrieved in a single query using a FULL OUTER JOIN. + +SELECT c2010.geo_name AS county_2010, + c2010.state_us_abbreviation AS state_2010, + c2000.geo_name AS county_2000, + c2000.state_us_abbreviation as state_2000 +FROM us_counties_2010 AS c2010 FULL OUTER JOIN us_counties_2000 AS c2000 +ON c2010.state_fips = c2000.state_fips + AND c2010.county_fips = c2000.county_fips +WHERE c2000.geo_name IS NULL OR c2010.geo_name IS NULL; + -- 2. Using either the median() or percentile_cont() functions in Chapter 5, -- determine the median of the percent change in county population.