Chapter 11 code/listing formatting
This commit is contained in:
parent
f9072555df
commit
4179793a4e
@ -5,7 +5,7 @@
|
|||||||
-- Chapter 11 Code Examples
|
-- Chapter 11 Code Examples
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Listing 11-1: Create Census 2014-2018 ACS 5-Year stats table and import data
|
-- Listing 11-1: Creating the census 2014-2018 ACS 5-Year Estimates stats table and importing data
|
||||||
|
|
||||||
CREATE TABLE acs_2014_2018_stats (
|
CREATE TABLE acs_2014_2018_stats (
|
||||||
geoid text CONSTRAINT geoid_key PRIMARY KEY,
|
geoid text CONSTRAINT geoid_key PRIMARY KEY,
|
||||||
@ -72,7 +72,7 @@ FROM acs_2014_2018_stats;
|
|||||||
SELECT stddev_pop(median_hh_income)
|
SELECT stddev_pop(median_hh_income)
|
||||||
FROM acs_2014_2018_stats;
|
FROM acs_2014_2018_stats;
|
||||||
|
|
||||||
-- Listing 11-6: The rank() and dense_rank() window functions
|
-- Listing 11-6: Using the rank() and dense_rank() window functions
|
||||||
|
|
||||||
CREATE TABLE widget_companies (
|
CREATE TABLE widget_companies (
|
||||||
id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||||
|
|||||||
@ -668,9 +668,9 @@ WHERE meat_processing = TRUE AND
|
|||||||
|
|
||||||
-- 1. In Listing 11-2, the correlation coefficient, or r value, of the
|
-- 1. In Listing 11-2, the correlation coefficient, or r value, of the
|
||||||
-- variables pct_bachelors_higher and median_hh_income was about .70.
|
-- variables pct_bachelors_higher and median_hh_income was about .70.
|
||||||
-- Write a query to show the correlation between pct_masters_higher and
|
-- Write a query using the same dataset to show the correlation between
|
||||||
-- median_hh_income. Is the r value higher or lower? What might explain
|
-- pct_masters_higher and median_hh_income. Is the r value higher or lower?
|
||||||
-- the difference?
|
-- What might explain the difference?
|
||||||
|
|
||||||
-- Answer:
|
-- Answer:
|
||||||
-- The r value of pct_bachelors_higher and median_hh_income is about .60, which
|
-- The r value of pct_bachelors_higher and median_hh_income is about .60, which
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user