diff --git a/Chapter_07/Chapter_07.sql b/Chapter_07/Chapter_07.sql index e94c777..b47624b 100644 --- a/Chapter_07/Chapter_07.sql +++ b/Chapter_07/Chapter_07.sql @@ -113,15 +113,18 @@ ORDER BY district_2020.id; -- Listing 7-9: Using CROSS JOIN SELECT * -FROM district_2020 CROSS JOIN district_2035; +FROM district_2020 CROSS JOIN district_2035 +ORDER BY district_2020.id, district_2035.id; -- Alternately, a CROSS JOIN can be written with a comma-join syntax: SELECT * -FROM district_2020, district_2035; +FROM district_2020, district_2035 +ORDER BY district_2020.id, district_2035.id; -- Or it can be written as a JOIN with true in the ON clause: SELECT * -FROM district_2020 JOIN district_2035 ON true; +FROM district_2020 JOIN district_2035 ON true +ORDER BY district_2020.id, district_2035.id; -- Listing 7-10: Filtering to show missing values with IS NULL diff --git a/Try_It_Yourself/Try_It_Yourself.sql b/Try_It_Yourself/Try_It_Yourself.sql index 15e8889..eb7c540 100644 --- a/Try_It_Yourself/Try_It_Yourself.sql +++ b/Try_It_Yourself/Try_It_Yourself.sql @@ -310,9 +310,9 @@ GROUP BY state_name; -- Chapter 7: Joining Tables in a Relational Database ---------------------------------------------------------------------------- --- 1. According to the Census population estimates, which county had the +-- 1. According to the census population estimates, which county had the -- greatest percentage loss of population between 2010 and 2019? Try --- an Internet search to find out what happened. (Hint: The loss is related +-- an internet search to find out what happened. (Hint: The loss is related -- to a particular type of facility.) -- Answer: @@ -337,7 +337,7 @@ ORDER BY pct_change ASC; -- 2. Apply the concepts you learned about UNION to create query --- results that merge queries of the Census county population estimates +-- results that merge queries of the census county population estimates -- for 2010 and 2019. Your results should include a column called year -- that specifies the year of the estimate for each row in the results.