Skip to content

Instantly share code, notes, and snippets.

@Keareys
Last active December 17, 2016 01:55
Show Gist options
  • Save Keareys/f31d111793dbf52611b9a54aabb8e82b to your computer and use it in GitHub Desktop.
Save Keareys/f31d111793dbf52611b9a54aabb8e82b to your computer and use it in GitHub Desktop.
Census: Creates a summary view by 2010 geography. This query is needed because there a multiple tract parts for 2010 tracts within the correspondence table (2010 to 2000)
SELECT
GEOID,
county,
TotalPop_ACS2014,
TotalWhitePop_ACS2014,
SUM(White_Alone_PopChange) as WhitePopChange,
TotalBlackPop_ACS2014,
SUM(Black_Alone_PopChange) as BlackPopChange,
Total_Hispanic_Latino_Pop_ACS2014,
SUM(Hispanic_Latino_PopChange) as Hispanic_LatinoPopChange,
TotalAsian_Pacific_IslanderPop_ACS2014,
SUM(Asian_Pacific_Islander_PopChange) as Asian_Pacific_IslanderPopChange,
SUM(PopChange) AS PopChange,
Pop65plus_ACS2014,
SUM(Pop65PlusChange) AS Pop65PlusChange,
Age65plusSOT,
Veterans_ACS2014,
SUM(VeteransChange) AS VeteransChange,
VeteransSOT,
LowIncomePop_ACS2014,
SUM(LowIncomePopChange) AS LowIncomePopChange,
LowIncPopSOT,
DisabledPop_ACS2014,
SUM(DisabledPopChange) AS DisabledPopChange,
DisabledPopSOT,
MinorityPopulation_ACS2014,
SUM(MinorityPopChange) AS MinorityPopChange,
MinorityPopSOT,
--Add Missing Vars here
--[POP_ZVHHS_Change], [POP_LEP_ACS2014],[POP_LEP_Change], [SPFAM_ACS2014], [SPFAM_Change], [POP_HUS_RENT50_ACS2014], [POP_HUS_RENT50_Change]
POP_ZVHHS_ACS2014,
SUM(POP_ZVHHS_Change) AS POP_ZVHHS_Change,
POP_LEP_ACS2014,
SUM(POP_LEP_Change) AS POP_LEP_Change,
SPFAM_ACS2014,
SUM(SPFAM_Change) AS SPFAM_Change,
POP_HUS_RENT50_ACS2014,
SUM(POP_HUS_RENT50_Change) AS POP_HUS_RENT50_Change
FROM Census2K_ACS2014_EJ_Select_Variables_Compare_Detail
GROUP BY GEOID, county, TotalPop_ACS2014, TotalWhitePop_ACS2014, TotalBlackPop_ACS2014, Total_Hispanic_Latino_Pop_ACS2014, TotalAsian_Pacific_IslanderPop_ACS2014, Pop65plus_ACS2014, Age65plusSOT, Veterans_ACS2014, VeteransSOT, LowIncomePop_ACS2014, LowIncPopSOT, DisabledPop_ACS2014, POP_ZVHHS_ACS2014,POP_LEP_ACS2014,SPFAM_ACS2014,POP_HUS_RENT50_ACS2014,DisabledPopSOT,MinorityPopulation_ACS2014,MinorityPopSOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment