Skip to content

Instantly share code, notes, and snippets.

@Keareys
Last active February 8, 2017 02:39
Show Gist options
  • Save Keareys/be6a53074831c65461113e49c96d8dee to your computer and use it in GitHub Desktop.
Save Keareys/be6a53074831c65461113e49c96d8dee to your computer and use it in GitHub Desktop.
ACS 2011 - 2015 Median Household Income to Home Value Ratio by County and Urban Areas. Uses ESRI 2016 FeatureClasses for Counties and Urban Areas as defined by the Census.
Go
create view Analysis.Income_to_HomeValue_Urban_Areas as
SELECT
Top 50000
hv.OBJECTID,
--hv.Id,
hv.Id2,
--hv.Geography,
c.STATE_FIPS as StateFips,
c.NAME as CountyName,
--c.CNTY_FIPS,
c.FIPS as StateCountyFIPS,
c.POP2010,
--c.POP10_SQMI,
hv.Median_value as HomeValue,
mi.Median_Household_Income as HouseholdIncome,
Cast(hv.Median_value/mi.Median_Household_Income as numeric(18,2)) as Housing_Ratio,
c.Shape
FROM
Analysis.HOME_VALUE AS hv INNER JOIN
Analysis.URBANAREAS_WITHIN_COUNTIES AS c ON hv.Id2 = c.FIPS INNER JOIN
Analysis.MEDIAN_INCOME_AND_HOUSEHOLDS as mi ON hv.Id2 = mi.Id2
Where mi.Median_Household_Income/hv.Median_value is not null --and c.FIPS like '06041'
Order By hv.Median_value/mi.Median_Household_Income asc
Go
select * From Analysis.Income_to_HomeValue_Urban_Areas
Go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment