August 30, 2010 at 7:10 am
Has anyone on these forums ever in their career come across a SELECT statement that was 60 pages long in a word document? This particular query that I came across was 5617 lines long, and I'm curious to know if anyone else has seen such a thing in their careers. If so, did you file this away as one of the worst SQL statements you've ever seen?
This query in question was produced by an application that we support on SQL Server 2008, and the developers are dynamically building the queries in .NET.
π
August 30, 2010 at 7:27 am
Although that does seem a bit excessive I would not just assume because the query is long winded that it is horrible. In fact, the query itself needs to be exactly as long as what is required to retrieve the desired data. I have seen some queries that have a very large amount of joins which can make them incredibly lengthy that were just fine. I have seen other queries in a single line that are far worse. (select * from ... comes to mind). I would have to say that 5k+ lines for a select statement is definitely outside of the range of a query that is manageable. :w00t:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 30, 2010 at 7:29 am
O.K, now I have to ask it β what was the fontβs size:-)? To answer your question, Iβve got some big ugly SQL Statements in the past, but not something that big.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
August 30, 2010 at 7:32 am
Wow. I've seen some pretty long ones, but I don't think it was quite that long. Then again, I usually dump mine to NotePad++, which (depending on the font used in Word), may save quite a bit of space - so maybe they're close enough.
Definitely not manageable - can you imagine trying to debug it? (Or, in my case, trying to get rid of the cursor that it's in the loop for?)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 30, 2010 at 7:33 am
Both funny and a good question...
The font is Consolas and the size is 10.5.
π
August 30, 2010 at 7:34 am
Here is the SELECT statement that was captured....
Seems pretty simple right?
==================================================================
SELECT SUM(case when disc_DiscountMC2 IS null then 1
else 0
end) as disc_DiscountMC2_BucketNullChars,
SUM(case when disc_DiscountMC2 = -1 then 1
else 0
end) as disc_DiscountMC2_BucketUnknown,
SUM(case when disc_DiscountMC2 < 0
and disc_DiscountMC2 <> -1 then 1
else 0
end) as disc_DiscountMC2_BucketError,
SUM(case when disc_DiscountMC2 >= 0
AND disc_DiscountMC2 < 1 then 1
else 0
end) as disc_DiscountMC2_Bucket0,
SUM(case when disc_DiscountMC2 >= 1 then 1
else 0
end) as disc_DiscountMC2_Bucket1,
SUM(case when disc_DiscountMC3 IS null then 1
else 0
end) as disc_DiscountMC3_BucketNullChars,
SUM(case when disc_DiscountMC3 = -1 then 1
else 0
end) as disc_DiscountMC3_BucketUnknown,
SUM(case when disc_DiscountMC3 < 0
and disc_DiscountMC3 <> -1 then 1
else 0
end) as disc_DiscountMC3_BucketError,
SUM(case when disc_DiscountMC3 >= 0
AND disc_DiscountMC3 < 1 then 1
else 0
end) as disc_DiscountMC3_Bucket0,
SUM(case when disc_DiscountMC3 >= 1 then 1
else 0
end) as disc_DiscountMC3_Bucket1,
SUM(case when disc_DiscountML1 IS null then 1
else 0
end) as disc_DiscountML1_BucketNullChars,
SUM(case when disc_DiscountML1 = -1 then 1
else 0
end) as disc_DiscountML1_BucketUnknown,
SUM(case when disc_DiscountML1 < 0
and disc_DiscountML1 <> -1 then 1
else 0
end) as disc_DiscountML1_BucketError,
SUM(case when disc_DiscountML1 >= 0
AND disc_DiscountML1 < 1 then 1
else 0
end) as disc_DiscountML1_Bucket0,
SUM(case when disc_DiscountML1 >= 1 then 1
else 0
end) as disc_DiscountML1_Bucket1,
SUM(case when end_Endorsement100 IS null then 1
else 0
end) as end_Endorsement100_BucketNullChars,
SUM(case when end_Endorsement100 = -1 then 1
else 0
end) as end_Endorsement100_BucketUnknown,
SUM(case when end_Endorsement100 < 0
and end_Endorsement100 <> -1 then 1
else 0
end) as end_Endorsement100_BucketError,
SUM(case when end_Endorsement100 >= 0
AND end_Endorsement100 < 1 then 1
else 0
end) as end_Endorsement100_Bucket0,
SUM(case when end_Endorsement100 >= 1 then 1
else 0
end) as end_Endorsement100_Bucket1,
SUM(case when end_Endorsement380 IS null then 1
else 0
end) as end_Endorsement380_BucketNullChars,
SUM(case when end_Endorsement380 = -1 then 1
else 0
end) as end_Endorsement380_BucketUnknown,
SUM(case when end_Endorsement380 < 0
and end_Endorsement380 <> -1 then 1
else 0
end) as end_Endorsement380_BucketError,
SUM(case when end_Endorsement380 >= 0
AND end_Endorsement380 < 1 then 1
else 0
end) as end_Endorsement380_Bucket0,
SUM(case when end_Endorsement380 >= 1 then 1
else 0
end) as end_Endorsement380_Bucket1,
SUM(case when end_Endorsement381 IS null then 1
else 0
end) as end_Endorsement381_BucketNullChars,
SUM(case when end_Endorsement381 = -1 then 1
else 0
end) as end_Endorsement381_BucketUnknown,
SUM(case when end_Endorsement381 < 0
and end_Endorsement381 <> -1 then 1
else 0
end) as end_Endorsement381_BucketError,
SUM(case when end_Endorsement381 >= 0
AND end_Endorsement381 < 1 then 1
else 0
end) as end_Endorsement381_Bucket0,
SUM(case when end_Endorsement381 >= 1 then 1
else 0
end) as end_Endorsement381_Bucket1,
SUM(case when m_Age IS null then 1
else 0
end) as m_Age_BucketNullChars,
SUM(case when m_Age = -1 then 1
else 0
end) as m_Age_BucketNoUnknown,
SUM(case when m_Age < 0
and m_Age <> -1 then 1
else 0
end) as m_Age_BucketError,
SUM(case when m_Age >= 0
AND m_Age < 25 then 1
else 0
end) as m_Age_Bucket0,
SUM(case when m_Age >= 25
AND m_Age < 32 then 1
else 0
end) as m_Age_Bucket1,
SUM(case when m_Age >= 32
AND m_Age < 43 then 1
else 0
end) as m_Age_Bucket2,
SUM(case when m_Age >= 43
AND m_Age < 52 then 1
else 0
end) as m_Age_Bucket3,
SUM(case when m_Age >= 52
AND m_Age < 58 then 1
else 0
end) as m_Age_Bucket4,
SUM(case when m_Age >= 58
AND m_Age < 66 then 1
else 0
end) as m_Age_Bucket5,
SUM(case when m_Age >= 66 then 1
else 0
end) as m_Age_Bucket6,
SUM(case when m_NumberOfRenewals IS null then 1
else 0
end) as m_NumberOfRenewals_BucketNullChars,
SUM(case when m_NumberOfRenewals = -1 then 1
else 0
end) as m_NumberOfRenewals_BucketNoUnknown,
SUM(case when m_NumberOfRenewals < 0
and m_NumberOfRenewals <> -1 then 1
else 0
end) as m_NumberOfRenewals_BucketError,
SUM(case when m_NumberOfRenewals >= 0
AND m_NumberOfRenewals < 2 then 1
else 0
end) as m_NumberOfRenewals_Bucket0,
SUM(case when m_NumberOfRenewals >= 2
AND m_NumberOfRenewals < 4 then 1
else 0
end) as m_NumberOfRenewals_Bucket1,
SUM(case when m_NumberOfRenewals >= 4
AND m_NumberOfRenewals < 8 then 1
else 0
end) as m_NumberOfRenewals_Bucket2,
SUM(case when m_NumberOfRenewals >= 8
AND m_NumberOfRenewals < 11 then 1
else 0
end) as m_NumberOfRenewals_Bucket3,
SUM(case when m_NumberOfRenewals >= 11
AND m_NumberOfRenewals < 15 then 1
else 0
end) as m_NumberOfRenewals_Bucket4,
SUM(case when m_NumberOfRenewals >= 15
AND m_NumberOfRenewals < 28 then 1
else 0
end) as m_NumberOfRenewals_Bucket5,
SUM(case when m_NumberOfRenewals >= 28 then 1
else 0
end) as m_NumberOfRenewals_Bucket6,
SUM(case when prior_Num_Events IS null then 1
else 0
end) as prior_Num_Events_BucketNullChars,
SUM(case when prior_Num_Events = -1 then 1
else 0
end) as prior_Num_Events_BucketUnknown,
SUM(case when prior_Num_Events < 0
and prior_Num_Events <> -1 then 1
else 0
end) as prior_Num_Events_BucketError,
SUM(case when prior_Num_Events >= 0
AND prior_Num_Events < 2 then 1
else 0
end) as prior_Num_Events_Bucket0,
SUM(case when prior_Num_Events >= 2 then 1
else 0
end) as prior_Num_Events_Bucket1,
SUM(case when prior_Num_Events_CurPts_GT_0 IS null then 1
else 0
end) as prior_Num_Events_CurPts_GT_0_BucketNullChars,
SUM(case when prior_Num_Events_CurPts_GT_0 = -1 then 1
else 0
end) as prior_Num_Events_CurPts_GT_0_BucketUnknown,
SUM(case when prior_Num_Events_CurPts_GT_0 < 0
and prior_Num_Events_CurPts_GT_0 <> -1 then 1
else 0
end) as prior_Num_Events_CurPts_GT_0_BucketError,
SUM(case when prior_Num_Events_CurPts_GT_0 >= 0
AND prior_Num_Events_CurPts_GT_0 < 1 then 1
else 0
end) as prior_Num_Events_CurPts_GT_0_Bucket0,
SUM(case when prior_Num_Events_CurPts_GT_0 >= 1 then 1
else 0
end) as prior_Num_Events_CurPts_GT_0_Bucket1,
SUM(case when prior_Num_Events_MVR_is_T IS null then 1
else 0
end) as prior_Num_Events_MVR_is_T_BucketNullChars,
SUM(case when prior_Num_Events_MVR_is_T = -1 then 1
else 0
end) as prior_Num_Events_MVR_is_T_BucketUnknown,
SUM(case when prior_Num_Events_MVR_is_T < 0
and prior_Num_Events_MVR_is_T <> -1 then 1
else 0
end) as prior_Num_Events_MVR_is_T_BucketError,
SUM(case when prior_Num_Events_MVR_is_T >= 0
AND prior_Num_Events_MVR_is_T < 1 then 1
else 0
end) as prior_Num_Events_MVR_is_T_Bucket0,
SUM(case when prior_Num_Events_MVR_is_T >= 1
AND prior_Num_Events_MVR_is_T < 2 then 1
else 0
end) as prior_Num_Events_MVR_is_T_Bucket1,
SUM(case when prior_Num_Events_MVR_is_T >= 2 then 1
else 0
end) as prior_Num_Events_MVR_is_T_Bucket2,
SUM(case when prior_Num_Events_MVR_is_U IS null then 1
else 0
end) as prior_Num_Events_MVR_is_U_BucketNullChars,
SUM(case when prior_Num_Events_MVR_is_U = -1 then 1
else 0
end) as prior_Num_Events_MVR_is_U_BucketUnknown,
SUM(case when prior_Num_Events_MVR_is_U < 0
and prior_Num_Events_MVR_is_U <> -1 then 1
else 0
end) as prior_Num_Events_MVR_is_U_BucketError,
SUM(case when prior_Num_Events_MVR_is_U >= 0
AND prior_Num_Events_MVR_is_U < 1 then 1
else 0
end) as prior_Num_Events_MVR_is_U_Bucket0,
SUM(case when prior_Num_Events_MVR_is_U >= 1 then 1
else 0
end) as prior_Num_Events_MVR_is_U_Bucket1,
SUM(case when prior_Num_Events_RenPts_GT_0 IS null then 1
else 0
end) as prior_Num_Events_RenPts_GT_0_BucketNullChars,
SUM(case when prior_Num_Events_RenPts_GT_0 = -1 then 1
else 0
end) as prior_Num_Events_RenPts_GT_0_BucketUnknown,
SUM(case when prior_Num_Events_RenPts_GT_0 < 0
and prior_Num_Events_RenPts_GT_0 <> -1 then 1
else 0
end) as prior_Num_Events_RenPts_GT_0_BucketError,
SUM(case when prior_Num_Events_RenPts_GT_0 >= 0
AND prior_Num_Events_RenPts_GT_0 < 1 then 1
else 0
end) as prior_Num_Events_RenPts_GT_0_Bucket0,
SUM(case when prior_Num_Events_RenPts_GT_0 >= 1 then 1
else 0
end) as prior_Num_Events_RenPts_GT_0_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_80_OneVehAx IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_80_OneVehAx_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_80_OneVehAx = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_80_OneVehAx_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_80_OneVehAx < 0
and prior_Num_Prior_Clm_with_80_OneVehAx <> -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_80_OneVehAx_BucketError,
SUM(case when prior_Num_Prior_Clm_with_80_OneVehAx >= 0
AND prior_Num_Prior_Clm_with_80_OneVehAx < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_80_OneVehAx_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_80_OneVehAx >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_80_OneVehAx_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay IS null
then 1
else 0
end) as prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay = -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay < 0
and prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay <> -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay_BucketError,
SUM(case when prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay >= 0
AND prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay < 1
then 1
else 0
end) as prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay >= 1
then 1
else 0
end) as prior_Num_Prior_Clm_with_81_ClmtClearRightOfWay_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_82_ClmtRearEnded IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_82_ClmtRearEnded_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_82_ClmtRearEnded = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_82_ClmtRearEnded_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_82_ClmtRearEnded < 0
and prior_Num_Prior_Clm_with_82_ClmtRearEnded <> -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_82_ClmtRearEnded_BucketError,
SUM(case when prior_Num_Prior_Clm_with_82_ClmtRearEnded >= 0
AND prior_Num_Prior_Clm_with_82_ClmtRearEnded < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_82_ClmtRearEnded_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_82_ClmtRearEnded >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_82_ClmtRearEnded_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_84_HitBambi IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_84_HitBambi_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_84_HitBambi = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_84_HitBambi_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_84_HitBambi < 0
and prior_Num_Prior_Clm_with_84_HitBambi <> -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_84_HitBambi_BucketError,
SUM(case when prior_Num_Prior_Clm_with_84_HitBambi >= 0
AND prior_Num_Prior_Clm_with_84_HitBambi < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_84_HitBambi_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_84_HitBambi >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_84_HitBambi_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_NoneOfFollowing IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_NoneOfFollowing_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_NoneOfFollowing = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_NoneOfFollowing_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_NoneOfFollowing < 0
and prior_Num_Prior_Clm_with_NoneOfFollowing <> -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_NoneOfFollowing_BucketError,
SUM(case when prior_Num_Prior_Clm_with_NoneOfFollowing >= 0
AND prior_Num_Prior_Clm_with_NoneOfFollowing < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_NoneOfFollowing_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_NoneOfFollowing >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_NoneOfFollowing_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_OtherErrorNotListed IS null
then 1
else 0
end) as prior_Num_Prior_Clm_with_OtherErrorNotListed_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_OtherErrorNotListed = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_OtherErrorNotListed_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_OtherErrorNotListed < 0
and prior_Num_Prior_Clm_with_OtherErrorNotListed <> -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_OtherErrorNotListed_BucketError,
SUM(case when prior_Num_Prior_Clm_with_OtherErrorNotListed >= 0
AND prior_Num_Prior_Clm_with_OtherErrorNotListed < 1
then 1
else 0
end) as prior_Num_Prior_Clm_with_OtherErrorNotListed_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_OtherErrorNotListed >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_OtherErrorNotListed_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_SingleVehicleAx IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_SingleVehicleAx_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_SingleVehicleAx = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_SingleVehicleAx_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_SingleVehicleAx < 0
and prior_Num_Prior_Clm_with_SingleVehicleAx <> -1
then 1
else 0
end) as prior_Num_Prior_Clm_with_SingleVehicleAx_BucketError,
SUM(case when prior_Num_Prior_Clm_with_SingleVehicleAx >= 0
AND prior_Num_Prior_Clm_with_SingleVehicleAx < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_SingleVehicleAx_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_SingleVehicleAx >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_SingleVehicleAx_Bucket1,
SUM(case when prior_Num_Prior_Clm_with_TwoVehicleAx IS null then 1
else 0
end) as prior_Num_Prior_Clm_with_TwoVehicleAx_BucketNullChars,
SUM(case when prior_Num_Prior_Clm_with_TwoVehicleAx = -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_TwoVehicleAx_BucketUnknown,
SUM(case when prior_Num_Prior_Clm_with_TwoVehicleAx < 0
and prior_Num_Prior_Clm_with_TwoVehicleAx <> -1 then 1
else 0
end) as prior_Num_Prior_Clm_with_TwoVehicleAx_BucketError,
SUM(case when prior_Num_Prior_Clm_with_TwoVehicleAx >= 0
AND prior_Num_Prior_Clm_with_TwoVehicleAx < 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_TwoVehicleAx_Bucket0,
SUM(case when prior_Num_Prior_Clm_with_TwoVehicleAx >= 1 then 1
else 0
end) as prior_Num_Prior_Clm_with_TwoVehicleAx_Bucket1,
SUM(case when prior_sum_CurrentPoints IS null then 1
else 0
end) as prior_sum_CurrentPoints_BucketNullChars,
SUM(case when prior_sum_CurrentPoints = -1 then 1
else 0
end) as prior_sum_CurrentPoints_BucketUnknown,
SUM(case when prior_sum_CurrentPoints < 0
and prior_sum_CurrentPoints <> -1 then 1
else 0
end) as prior_sum_CurrentPoints_BucketError,
SUM(case when prior_sum_CurrentPoints >= 0
AND prior_sum_CurrentPoints < 2 then 1
else 0
end) as prior_sum_CurrentPoints_Bucket0,
SUM(case when prior_sum_CurrentPoints >= 2 then 1
else 0
end) as prior_sum_CurrentPoints_Bucket1,
SUM(case when prior_sum_CurrentPoints_MVR_is_T IS null then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_T_BucketNullChars,
SUM(case when prior_sum_CurrentPoints_MVR_is_T = -1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_T_BucketUnknown,
SUM(case when prior_sum_CurrentPoints_MVR_is_T < 0
and prior_sum_CurrentPoints_MVR_is_T <> -1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_T_BucketError,
SUM(case when prior_sum_CurrentPoints_MVR_is_T >= 0
AND prior_sum_CurrentPoints_MVR_is_T < 1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_T_Bucket0,
SUM(case when prior_sum_CurrentPoints_MVR_is_T >= 1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_T_Bucket1,
SUM(case when prior_sum_CurrentPoints_MVR_is_U IS null then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_U_BucketNullChars,
SUM(case when prior_sum_CurrentPoints_MVR_is_U = -1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_U_BucketUnknown,
SUM(case when prior_sum_CurrentPoints_MVR_is_U < 0
and prior_sum_CurrentPoints_MVR_is_U <> -1 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_U_BucketError,
SUM(case when prior_sum_CurrentPoints_MVR_is_U >= 0
AND prior_sum_CurrentPoints_MVR_is_U < 2 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_U_Bucket0,
SUM(case when prior_sum_CurrentPoints_MVR_is_U >= 2 then 1
else 0
end) as prior_sum_CurrentPoints_MVR_is_U_Bucket1,
SUM(case when prior_sum_RenPoints IS null then 1
else 0
end) as prior_sum_RenPoints_BucketNullChars,
SUM(case when prior_sum_RenPoints = -1 then 1
else 0
end) as prior_sum_RenPoints_BucketUnknown,
SUM(case when prior_sum_RenPoints < 0
and prior_sum_RenPoints <> -1 then 1
else 0
end) as prior_sum_RenPoints_BucketError,
SUM(case when prior_sum_RenPoints >= 0
AND prior_sum_RenPoints < 1 then 1
else 0
end) as prior_sum_RenPoints_Bucket0,
SUM(case when prior_sum_RenPoints >= 1 then 1
else 0
end) as prior_sum_RenPoints_Bucket1,
SUM(case when prior_sum_RenPoints_MVR_is_T IS null then 1
else 0
end) as prior_sum_RenPoints_MVR_is_T_BucketNullChars,
SUM(case when prior_sum_RenPoints_MVR_is_T = -1 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_T_BucketUnknown,
SUM(case when prior_sum_RenPoints_MVR_is_T < 0
and prior_sum_RenPoints_MVR_is_T <> -1 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_T_BucketError,
SUM(case when prior_sum_RenPoints_MVR_is_T >= 0
AND prior_sum_RenPoints_MVR_is_T < 3 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_T_Bucket0,
SUM(case when prior_sum_RenPoints_MVR_is_T >= 3 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_T_Bucket1,
SUM(case when prior_sum_RenPoints_MVR_is_U IS null then 1
else 0
end) as prior_sum_RenPoints_MVR_is_U_BucketNullChars,
SUM(case when prior_sum_RenPoints_MVR_is_U = -1 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_U_BucketUnknown,
SUM(case when prior_sum_RenPoints_MVR_is_U < 0
and prior_sum_RenPoints_MVR_is_U <> -1 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_U_BucketError,
SUM(case when prior_sum_RenPoints_MVR_is_U >= 0
AND prior_sum_RenPoints_MVR_is_U < 2 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_U_Bucket0,
SUM(case when prior_sum_RenPoints_MVR_is_U >= 2 then 1
else 0
end) as prior_sum_RenPoints_MVR_is_U_Bucket1,
SUM(case when zip_CrimeArsonIdx IS null then 1
else 0
end) as zip_CrimeArsonIdx_BucketNullChars,
SUM(case when zip_CrimeArsonIdx = -1 then 1
else 0
end) as zip_CrimeArsonIdx_BucketUnknown,
SUM(case when zip_CrimeArsonIdx < 0
and zip_CrimeArsonIdx <> -1 then 1
else 0
end) as zip_CrimeArsonIdx_BucketError,
SUM(case when zip_CrimeArsonIdx >= 0
AND zip_CrimeArsonIdx < 4 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket0,
SUM(case when zip_CrimeArsonIdx >= 4
AND zip_CrimeArsonIdx < 11 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket1,
SUM(case when zip_CrimeArsonIdx >= 11
AND zip_CrimeArsonIdx < 22 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket2,
SUM(case when zip_CrimeArsonIdx >= 22
AND zip_CrimeArsonIdx < 35 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket3,
SUM(case when zip_CrimeArsonIdx >= 35
AND zip_CrimeArsonIdx < 76 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket4,
SUM(case when zip_CrimeArsonIdx >= 76 then 1
else 0
end) as zip_CrimeArsonIdx_Bucket5,
SUM(case when zip_CrimeAssaultIdx IS null then 1
else 0
end) as zip_CrimeAssaultIdx_BucketNullChars,
SUM(case when zip_CrimeAssaultIdx = -1 then 1
else 0
end) as zip_CrimeAssaultIdx_BucketUnknown,
SUM(case when zip_CrimeAssaultIdx < 0
and zip_CrimeAssaultIdx <> -1 then 1
else 0
end) as zip_CrimeAssaultIdx_BucketError,
SUM(case when zip_CrimeAssaultIdx >= 0
AND zip_CrimeAssaultIdx < 19 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket0,
SUM(case when zip_CrimeAssaultIdx >= 19
AND zip_CrimeAssaultIdx < 28 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket1,
SUM(case when zip_CrimeAssaultIdx >= 28
AND zip_CrimeAssaultIdx < 55 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket2,
SUM(case when zip_CrimeAssaultIdx >= 55
AND zip_CrimeAssaultIdx < 89 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket3,
SUM(case when zip_CrimeAssaultIdx >= 89
AND zip_CrimeAssaultIdx < 127 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket4,
SUM(case when zip_CrimeAssaultIdx >= 127
AND zip_CrimeAssaultIdx < 237 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket5,
SUM(case when zip_CrimeAssaultIdx >= 237
AND zip_CrimeAssaultIdx < 353 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket6,
SUM(case when zip_CrimeAssaultIdx >= 353 then 1
else 0
end) as zip_CrimeAssaultIdx_Bucket7,
SUM(case when zip_CrimeBurglaryIdx IS null then 1
else 0
end) as zip_CrimeBurglaryIdx_BucketNullChars,
SUM(case when zip_CrimeBurglaryIdx = -1 then 1
else 0
end) as zip_CrimeBurglaryIdx_BucketUnknown,
SUM(case when zip_CrimeBurglaryIdx < 0
and zip_CrimeBurglaryIdx <> -1 then 1
else 0
end) as zip_CrimeBurglaryIdx_BucketError,
SUM(case when zip_CrimeBurglaryIdx >= 0
AND zip_CrimeBurglaryIdx < 221 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket0,
SUM(case when zip_CrimeBurglaryIdx >= 221
AND zip_CrimeBurglaryIdx < 394 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket1,
SUM(case when zip_CrimeBurglaryIdx >= 394
AND zip_CrimeBurglaryIdx < 464 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket2,
SUM(case when zip_CrimeBurglaryIdx >= 464
AND zip_CrimeBurglaryIdx < 646 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket3,
SUM(case when zip_CrimeBurglaryIdx >= 646
AND zip_CrimeBurglaryIdx < 754 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket4,
SUM(case when zip_CrimeBurglaryIdx >= 754
AND zip_CrimeBurglaryIdx < 959 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket5,
SUM(case when zip_CrimeBurglaryIdx >= 959 then 1
else 0
end) as zip_CrimeBurglaryIdx_Bucket6,
SUM(case when zip_CrimeIndexTotal IS null then 1
else 0
end) as zip_CrimeIndexTotal_BucketNullChars,
SUM(case when zip_CrimeIndexTotal = -1 then 1
else 0
end) as zip_CrimeIndexTotal_BucketUnknown,
SUM(case when zip_CrimeIndexTotal < 0
and zip_CrimeIndexTotal <> -1 then 1
else 0
end) as zip_CrimeIndexTotal_BucketError,
SUM(case when zip_CrimeIndexTotal >= 0
AND zip_CrimeIndexTotal < 1455 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket0,
SUM(case when zip_CrimeIndexTotal >= 1455
AND zip_CrimeIndexTotal < 2045 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket1,
SUM(case when zip_CrimeIndexTotal >= 2045
AND zip_CrimeIndexTotal < 2803 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket2,
SUM(case when zip_CrimeIndexTotal >= 2803
AND zip_CrimeIndexTotal < 3925 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket3,
SUM(case when zip_CrimeIndexTotal >= 3925
AND zip_CrimeIndexTotal < 4437 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket4,
SUM(case when zip_CrimeIndexTotal >= 4437
AND zip_CrimeIndexTotal < 5258 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket5,
SUM(case when zip_CrimeIndexTotal >= 5258 then 1
else 0
end) as zip_CrimeIndexTotal_Bucket6,
SUM(case when zip_CrimeMurderIdx IS null then 1
else 0
end) as zip_CrimeMurderIdx_BucketNullChars,
SUM(case when zip_CrimeMurderIdx = -1 then 1
else 0
end) as zip_CrimeMurderIdx_BucketUnknown,
SUM(case when zip_CrimeMurderIdx < 0
and zip_CrimeMurderIdx <> -1 then 1
else 0
end) as zip_CrimeMurderIdx_BucketError,
SUM(case when zip_CrimeMurderIdx >= 0
AND zip_CrimeMurderIdx < 2 then 1
else 0
end) as zip_CrimeMurderIdx_Bucket0,
SUM(case when zip_CrimeMurderIdx >= 2
AND zip_CrimeMurderIdx < 5 then 1
else 0
end) as zip_CrimeMurderIdx_Bucket1,
SUM(case when zip_CrimeMurderIdx >= 5 then 1
else 0
end) as zip_CrimeMurderIdx_Bucket2,
SUM(case when zip_CrimeRapeIdx IS null then 1
else 0
end) as zip_CrimeRapeIdx_BucketNullChars,
SUM(case when zip_CrimeRapeIdx = -1 then 1
else 0
end) as zip_CrimeRapeIdx_BucketUnknown,
SUM(case when zip_CrimeRapeIdx < 0
and zip_CrimeRapeIdx <> -1 then 1
else 0
end) as zip_CrimeRapeIdx_BucketError,
SUM(case when zip_CrimeRapeIdx >= 0
AND zip_CrimeRapeIdx < 12 then 1
else 0
end) as zip_CrimeRapeIdx_Bucket0,
SUM(case when zip_CrimeRapeIdx >= 12
AND zip_CrimeRapeIdx < 29 then 1
else 0
end) as zip_CrimeRapeIdx_Bucket1,
SUM(case when zip_CrimeRapeIdx >= 29
AND zip_CrimeRapeIdx < 42 then 1
else 0
end) as zip_CrimeRapeIdx_Bucket2,
SUM(case when zip_CrimeRapeIdx >= 42
AND zip_CrimeRapeIdx < 47 then 1
else 0
end) as zip_CrimeRapeIdx_Bucket3,
SUM(case when zip_CrimeRapeIdx >= 47 then 1
else 0
end) as zip_CrimeRapeIdx_Bucket4,
SUM(case when zip_CrimeRobberyIdx IS null then 1
else 0
end) as zip_CrimeRobberyIdx_BucketNullChars,
SUM(case when zip_CrimeRobberyIdx = -1 then 1
else 0
end) as zip_CrimeRobberyIdx_BucketUnknown,
SUM(case when zip_CrimeRobberyIdx < 0
and zip_CrimeRobberyIdx <> -1 then 1
else 0
end) as zip_CrimeRobberyIdx_BucketError,
SUM(case when zip_CrimeRobberyIdx >= 0
AND zip_CrimeRobberyIdx < 8 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket0,
SUM(case when zip_CrimeRobberyIdx >= 8
AND zip_CrimeRobberyIdx < 22 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket1,
SUM(case when zip_CrimeRobberyIdx >= 22
AND zip_CrimeRobberyIdx < 36 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket2,
SUM(case when zip_CrimeRobberyIdx >= 36
AND zip_CrimeRobberyIdx < 51 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket3,
SUM(case when zip_CrimeRobberyIdx >= 51
AND zip_CrimeRobberyIdx < 83 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket4,
SUM(case when zip_CrimeRobberyIdx >= 83
AND zip_CrimeRobberyIdx < 152 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket5,
SUM(case when zip_CrimeRobberyIdx >= 152 then 1
else 0
end) as zip_CrimeRobberyIdx_Bucket6,
SUM(case when zip_CrimeTheftIdx IS null then 1
else 0
end) as zip_CrimeTheftIdx_BucketNullChars,
SUM(case when zip_CrimeTheftIdx = -1 then 1
else 0
end) as zip_CrimeTheftIdx_BucketUnknown,
SUM(case when zip_CrimeTheftIdx < 0
and zip_CrimeTheftIdx <> -1 then 1
else 0
end) as zip_CrimeTheftIdx_BucketError,
SUM(case when zip_CrimeTheftIdx >= 0
AND zip_CrimeTheftIdx < 1097 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket0,
SUM(case when zip_CrimeTheftIdx >= 1097
AND zip_CrimeTheftIdx < 1789 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket1,
SUM(case when zip_CrimeTheftIdx >= 1789
AND zip_CrimeTheftIdx < 2409 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket2,
SUM(case when zip_CrimeTheftIdx >= 2409
AND zip_CrimeTheftIdx < 3423 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket3,
SUM(case when zip_CrimeTheftIdx >= 3423
AND zip_CrimeTheftIdx < 3994 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket4,
SUM(case when zip_CrimeTheftIdx >= 3994
AND zip_CrimeTheftIdx < 4697 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket5,
SUM(case when zip_CrimeTheftIdx >= 4697 then 1
else 0
end) as zip_CrimeTheftIdx_Bucket6,
SUM(case when zip_CrimeVehicleTheftIdx IS null then 1
else 0
end) as zip_CrimeVehicleTheftIdx_BucketNullChars,
SUM(case when zip_CrimeVehicleTheftIdx = -1 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_BucketUnknown,
SUM(case when zip_CrimeVehicleTheftIdx < 0
and zip_CrimeVehicleTheftIdx <> -1 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_BucketError,
SUM(case when zip_CrimeVehicleTheftIdx >= 0
AND zip_CrimeVehicleTheftIdx < 49 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket0,
SUM(case when zip_CrimeVehicleTheftIdx >= 49
AND zip_CrimeVehicleTheftIdx < 95 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket1,
SUM(case when zip_CrimeVehicleTheftIdx >= 95
AND zip_CrimeVehicleTheftIdx < 115 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket2,
SUM(case when zip_CrimeVehicleTheftIdx >= 115
AND zip_CrimeVehicleTheftIdx < 187 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket3,
SUM(case when zip_CrimeVehicleTheftIdx >= 187
AND zip_CrimeVehicleTheftIdx < 281 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket4,
SUM(case when zip_CrimeVehicleTheftIdx >= 281 then 1
else 0
end) as zip_CrimeVehicleTheftIdx_Bucket5,
SUM(case when zip_MeanDewPoint20Year IS null then 1
else 0
end) as zip_MeanDewPoint20Year_BucketNullChars,
SUM(case when zip_MeanDewPoint20Year = -1 then 1
else 0
end) as zip_MeanDewPoint20Year_BucketUnknown,
SUM(case when zip_MeanDewPoint20Year < 0
and zip_MeanDewPoint20Year <> -1 then 1
else 0
end) as zip_MeanDewPoint20Year_BucketError,
SUM(case when zip_MeanDewPoint20Year >= 0
AND zip_MeanDewPoint20Year < 43 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket0,
SUM(case when zip_MeanDewPoint20Year >= 43
AND zip_MeanDewPoint20Year < 45 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket1,
SUM(case when zip_MeanDewPoint20Year >= 45
AND zip_MeanDewPoint20Year < 48 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket2,
SUM(case when zip_MeanDewPoint20Year >= 48
AND zip_MeanDewPoint20Year < 225 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket3,
SUM(case when zip_MeanDewPoint20Year >= 225
AND zip_MeanDewPoint20Year < 498 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket4,
SUM(case when zip_MeanDewPoint20Year >= 498
AND zip_MeanDewPoint20Year < 617 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket5,
SUM(case when zip_MeanDewPoint20Year >= 617 then 1
else 0
end) as zip_MeanDewPoint20Year_Bucket6,
SUM(case when zip_MeanFogDays20Year IS null then 1
else 0
end) as zip_MeanFogDays20Year_BucketNullChars,
SUM(case when zip_MeanFogDays20Year = -1 then 1
else 0
end) as zip_MeanFogDays20Year_BucketUnknown,
SUM(case when zip_MeanFogDays20Year < 0
and zip_MeanFogDays20Year <> -1 then 1
else 0
end) as zip_MeanFogDays20Year_BucketError,
SUM(case when zip_MeanFogDays20Year >= 0
AND zip_MeanFogDays20Year < 36 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket0,
SUM(case when zip_MeanFogDays20Year >= 36
AND zip_MeanFogDays20Year < 51 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket1,
SUM(case when zip_MeanFogDays20Year >= 51
AND zip_MeanFogDays20Year < 63 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket2,
SUM(case when zip_MeanFogDays20Year >= 63
AND zip_MeanFogDays20Year < 77 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket3,
SUM(case when zip_MeanFogDays20Year >= 77
AND zip_MeanFogDays20Year < 92 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket4,
SUM(case when zip_MeanFogDays20Year >= 92
AND zip_MeanFogDays20Year < 127 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket5,
SUM(case when zip_MeanFogDays20Year >= 127 then 1
else 0
end) as zip_MeanFogDays20Year_Bucket6,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year IS null then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_BucketNullChars,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year = -1 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_BucketUnknown,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year < 0
and zip_MeanMaxSustainedWindSpeed20Year <> -1 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_BucketError,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 0
AND zip_MeanMaxSustainedWindSpeed20Year < 33 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket0,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 33
AND zip_MeanMaxSustainedWindSpeed20Year < 34 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket1,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 34
AND zip_MeanMaxSustainedWindSpeed20Year < 35 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket2,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 35
AND zip_MeanMaxSustainedWindSpeed20Year < 36 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket3,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 36
AND zip_MeanMaxSustainedWindSpeed20Year < 37 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket4,
SUM(case when zip_MeanMaxSustainedWindSpeed20Year >= 37 then 1
else 0
end) as zip_MeanMaxSustainedWindSpeed20Year_Bucket5,
SUM(case when zip_MeanMaxTemperature20Year IS null then 1
else 0
end) as zip_MeanMaxTemperature20Year_BucketNullChars,
SUM(case when zip_MeanMaxTemperature20Year = -1 then 1
else 0
end) as zip_MeanMaxTemperature20Year_BucketUnknown,
SUM(case when zip_MeanMaxTemperature20Year < 0
and zip_MeanMaxTemperature20Year <> -1 then 1
else 0
end) as zip_MeanMaxTemperature20Year_BucketError,
SUM(case when zip_MeanMaxTemperature20Year >= 0
AND zip_MeanMaxTemperature20Year < 94 then 1
else 0
end) as zip_MeanMaxTemperature20Year_Bucket0,
SUM(case when zip_MeanMaxTemperature20Year >= 94
AND zip_MeanMaxTemperature20Year < 95 then 1
else 0
end) as zip_MeanMaxTemperature20Year_Bucket1,
SUM(case when zip_MeanMaxTemperature20Year >= 95
AND zip_MeanMaxTemperature20Year < 96 then 1
else 0
end) as zip_MeanMaxTemperature20Year_Bucket2,
SUM(case when zip_MeanMaxTemperature20Year >= 96 then 1
else 0
end) as zip_MeanMaxTemperature20Year_Bucket3,
SUM(case when zip_MeanMaxWindGustSpeed20Year IS null then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_BucketNullChars,
SUM(case when zip_MeanMaxWindGustSpeed20Year = -1 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_BucketUnknown,
SUM(case when zip_MeanMaxWindGustSpeed20Year < 0
and zip_MeanMaxWindGustSpeed20Year <> -1 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_BucketError,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 0
AND zip_MeanMaxWindGustSpeed20Year < 45 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket0,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 45
AND zip_MeanMaxWindGustSpeed20Year < 46 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket1,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 46
AND zip_MeanMaxWindGustSpeed20Year < 47 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket2,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 47
AND zip_MeanMaxWindGustSpeed20Year < 48 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket3,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 48
AND zip_MeanMaxWindGustSpeed20Year < 50 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket4,
SUM(case when zip_MeanMaxWindGustSpeed20Year >= 50 then 1
else 0
end) as zip_MeanMaxWindGustSpeed20Year_Bucket5,
SUM(case when zip_MeanRainOrDrizzleDays20Year IS null then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_BucketNullChars,
SUM(case when zip_MeanRainOrDrizzleDays20Year = -1 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_BucketUnknown,
SUM(case when zip_MeanRainOrDrizzleDays20Year < 0
and zip_MeanRainOrDrizzleDays20Year <> -1 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_BucketError,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 0
AND zip_MeanRainOrDrizzleDays20Year < 66 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket0,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 66
AND zip_MeanRainOrDrizzleDays20Year < 83 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket1,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 83
AND zip_MeanRainOrDrizzleDays20Year < 91 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket2,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 91
AND zip_MeanRainOrDrizzleDays20Year < 102 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket3,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 102
AND zip_MeanRainOrDrizzleDays20Year < 119 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket4,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 119
AND zip_MeanRainOrDrizzleDays20Year < 130 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket5,
SUM(case when zip_MeanRainOrDrizzleDays20Year >= 130 then 1
else 0
end) as zip_MeanRainOrDrizzleDays20Year_Bucket6,
SUM(case when zip_MeanSeaLevelPressure20Year IS null then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_BucketNullChars,
SUM(case when zip_MeanSeaLevelPressure20Year = -1 then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_BucketUnknown,
SUM(case when zip_MeanSeaLevelPressure20Year < 0
and zip_MeanSeaLevelPressure20Year <> -1 then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_BucketError,
SUM(case when zip_MeanSeaLevelPressure20Year >= 0
AND zip_MeanSeaLevelPressure20Year < 1018 then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_Bucket0,
SUM(case when zip_MeanSeaLevelPressure20Year >= 1018
AND zip_MeanSeaLevelPressure20Year < 1019 then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_Bucket1,
SUM(case when zip_MeanSeaLevelPressure20Year >= 1019 then 1
else 0
end) as zip_MeanSeaLevelPressure20Year_Bucket2,
SUM(case when zip_MeanSnowDepth20Year IS null then 1
else 0
end) as zip_MeanSnowDepth20Year_BucketNullChars,
SUM(case when zip_MeanSnowDepth20Year = -1 then 1
else 0
end) as zip_MeanSnowDepth20Year_BucketUnknown,
SUM(case when zip_MeanSnowDepth20Year < 0
and zip_MeanSnowDepth20Year <> -1 then 1
else 0
end) as zip_MeanSnowDepth20Year_BucketError,
SUM(case when zip_MeanSnowDepth20Year >= 0
AND zip_MeanSnowDepth20Year < 2 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket0,
SUM(case when zip_MeanSnowDepth20Year >= 2
AND zip_MeanSnowDepth20Year < 4 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket1,
SUM(case when zip_MeanSnowDepth20Year >= 4
AND zip_MeanSnowDepth20Year < 6 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket2,
SUM(case when zip_MeanSnowDepth20Year >= 6
AND zip_MeanSnowDepth20Year < 24 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket3,
SUM(case when zip_MeanSnowDepth20Year >= 24
AND zip_MeanSnowDepth20Year < 41 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket4,
SUM(case when zip_MeanSnowDepth20Year >= 41
AND zip_MeanSnowDepth20Year < 97 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket5,
SUM(case when zip_MeanSnowDepth20Year >= 97 then 1
else 0
end) as zip_MeanSnowDepth20Year_Bucket6,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year IS null then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_BucketNullChars,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year = -1 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_BucketUnknown,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year < 0
and zip_MeanSnowOrIcePelletsDays20Year <> -1 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_BucketError,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 0
AND zip_MeanSnowOrIcePelletsDays20Year < 20 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket0,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 20
AND zip_MeanSnowOrIcePelletsDays20Year < 22 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket1,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 22
AND zip_MeanSnowOrIcePelletsDays20Year < 28 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket2,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 28
AND zip_MeanSnowOrIcePelletsDays20Year < 35 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket3,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 35
AND zip_MeanSnowOrIcePelletsDays20Year < 41 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket4,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 41
AND zip_MeanSnowOrIcePelletsDays20Year < 49 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket5,
SUM(case when zip_MeanSnowOrIcePelletsDays20Year >= 49 then 1
else 0
end) as zip_MeanSnowOrIcePelletsDays20Year_Bucket6,
SUM(case when zip_MeanStationPressure20Year IS null then 1
else 0
end) as zip_MeanStationPressure20Year_BucketNullChars,
SUM(case when zip_MeanStationPressure20Year = -1 then 1
else 0
end) as zip_MeanStationPressure20Year_BucketUnknown,
SUM(case when zip_MeanStationPressure20Year < 0
and zip_MeanStationPressure20Year <> -1 then 1
else 0
end) as zip_MeanStationPressure20Year_BucketError,
SUM(case when zip_MeanStationPressure20Year >= 0
AND zip_MeanStationPressure20Year < 992 then 1
else 0
end) as zip_MeanStationPressure20Year_Bucket0,
SUM(case when zip_MeanStationPressure20Year >= 992
AND zip_MeanStationPressure20Year < 1005 then 1
else 0
end) as zip_MeanStationPressure20Year_Bucket1,
SUM(case when zip_MeanStationPressure20Year >= 1005 then 1
else 0
end) as zip_MeanStationPressure20Year_Bucket2,
SUM(case when zip_MeanTemperature20Year IS null then 1
else 0
end) as zip_MeanTemperature20Year_BucketNullChars,
SUM(case when zip_MeanTemperature20Year = -1 then 1
else 0
end) as zip_MeanTemperature20Year_BucketUnknown,
SUM(case when zip_MeanTemperature20Year < 0
and zip_MeanTemperature20Year <> -1 then 1
else 0
end) as zip_MeanTemperature20Year_BucketError,
SUM(case when zip_MeanTemperature20Year >= 0
AND zip_MeanTemperature20Year < 52 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket0,
SUM(case when zip_MeanTemperature20Year >= 52
AND zip_MeanTemperature20Year < 53 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket1,
SUM(case when zip_MeanTemperature20Year >= 53
AND zip_MeanTemperature20Year < 54 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket2,
SUM(case when zip_MeanTemperature20Year >= 54
AND zip_MeanTemperature20Year < 55 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket3,
SUM(case when zip_MeanTemperature20Year >= 55
AND zip_MeanTemperature20Year < 56 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket4,
SUM(case when zip_MeanTemperature20Year >= 56 then 1
else 0
end) as zip_MeanTemperature20Year_Bucket5,
SUM(case when zip_MeanThunderDays20Year IS null then 1
else 0
end) as zip_MeanThunderDays20Year_BucketNullChars,
SUM(case when zip_MeanThunderDays20Year = -1 then 1
else 0
end) as zip_MeanThunderDays20Year_BucketUnknown,
SUM(case when zip_MeanThunderDays20Year < 0
and zip_MeanThunderDays20Year <> -1 then 1
else 0
end) as zip_MeanThunderDays20Year_BucketError,
SUM(case when zip_MeanThunderDays20Year >= 0
AND zip_MeanThunderDays20Year < 20 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket0,
SUM(case when zip_MeanThunderDays20Year >= 20
AND zip_MeanThunderDays20Year < 23 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket1,
SUM(case when zip_MeanThunderDays20Year >= 23
AND zip_MeanThunderDays20Year < 30 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket2,
SUM(case when zip_MeanThunderDays20Year >= 30
AND zip_MeanThunderDays20Year < 35 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket3,
SUM(case when zip_MeanThunderDays20Year >= 35
AND zip_MeanThunderDays20Year < 38 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket4,
SUM(case when zip_MeanThunderDays20Year >= 38
AND zip_MeanThunderDays20Year < 42 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket5,
SUM(case when zip_MeanThunderDays20Year >= 42 then 1
else 0
end) as zip_MeanThunderDays20Year_Bucket6,
SUM(case when zip_MeanTotalPrecipitation20Year IS null then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_BucketNullChars,
SUM(case when zip_MeanTotalPrecipitation20Year = -1 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_BucketUnknown,
SUM(case when zip_MeanTotalPrecipitation20Year < 0
and zip_MeanTotalPrecipitation20Year <> -1 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_BucketError,
SUM(case when zip_MeanTotalPrecipitation20Year >= 0
AND zip_MeanTotalPrecipitation20Year < 1 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket0,
SUM(case when zip_MeanTotalPrecipitation20Year >= 1
AND zip_MeanTotalPrecipitation20Year < 15 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket1,
SUM(case when zip_MeanTotalPrecipitation20Year >= 15
AND zip_MeanTotalPrecipitation20Year < 20 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket2,
SUM(case when zip_MeanTotalPrecipitation20Year >= 20
AND zip_MeanTotalPrecipitation20Year < 33 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket3,
SUM(case when zip_MeanTotalPrecipitation20Year >= 33
AND zip_MeanTotalPrecipitation20Year < 39 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket4,
SUM(case when zip_MeanTotalPrecipitation20Year >= 39
AND zip_MeanTotalPrecipitation20Year < 40 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket5,
SUM(case when zip_MeanTotalPrecipitation20Year >= 40 then 1
else 0
end) as zip_MeanTotalPrecipitation20Year_Bucket6,
SUM(case when zip_MeanVisibility20Year IS null then 1
else 0
end) as zip_MeanVisibility20Year_BucketNullChars,
SUM(case when zip_MeanVisibility20Year = -1 then 1
else 0
end) as zip_MeanVisibility20Year_BucketUnknown,
SUM(case when zip_MeanVisibility20Year < 0
and zip_MeanVisibility20Year <> -1 then 1
else 0
end) as zip_MeanVisibility20Year_BucketError,
SUM(case when zip_MeanVisibility20Year >= 0
AND zip_MeanVisibility20Year < 9 then 1
else 0
end) as zip_MeanVisibility20Year_Bucket0,
SUM(case when zip_MeanVisibility20Year >= 9 then 1
else 0
end) as zip_MeanVisibility20Year_Bucket1,
SUM(case when zip_MeanWindSpeed20Year IS null then 1
else 0
end) as zip_MeanWindSpeed20Year_BucketNullChars,
SUM(case when zip_MeanWindSpeed20Year = -1 then 1
else 0
end) as zip_MeanWindSpeed20Year_BucketUnknown,
SUM(case when zip_MeanWindSpeed20Year < 0
and zip_MeanWindSpeed20Year <> -1 then 1
else 0
end) as zip_MeanWindSpeed20Year_BucketError,
SUM(case when zip_MeanWindSpeed20Year >= 0
AND zip_MeanWindSpeed20Year < 7 then 1
else 0
end) as zip_MeanWindSpeed20Year_Bucket0,
SUM(case when zip_MeanWindSpeed20Year >= 7
AND zip_MeanWindSpeed20Year < 8 then 1
else 0
end) as zip_MeanWindSpeed20Year_Bucket1,
SUM(case when zip_MeanWindSpeed20Year >= 8
AND zip_MeanWindSpeed20Year < 9 then 1
else 0
end) as zip_MeanWindSpeed20Year_Bucket2,
SUM(case when zip_MeanWindSpeed20Year >= 9 then 1
else 0
end) as zip_MeanWindSpeed20Year_Bucket3,
SUM(case when zip_ZIP_Area IS null then 1
else 0
end) as zip_ZIP_Area_BucketNullChars,
SUM(case when zip_ZIP_Area = -1 then 1
else 0
end) as zip_ZIP_Area_BucketUnknown,
SUM(case when zip_ZIP_Area < 0
and zip_ZIP_Area <> -1 then 1
else 0
end) as zip_ZIP_Area_BucketError,
SUM(case when zip_ZIP_Area >= 0
AND zip_ZIP_Area < 3 then 1
else 0
end) as zip_ZIP_Area_Bucket0,
SUM(case when zip_ZIP_Area >= 3
AND zip_ZIP_Area < 4 then 1
else 0
end) as zip_ZIP_Area_Bucket1,
SUM(case when zip_ZIP_Area >= 4 then 1
else 0
end) as zip_ZIP_Area_Bucket2,
SUM(case when zip_ZIP_HousingMedianHomeCost IS null then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_BucketNullChars,
SUM(case when zip_ZIP_HousingMedianHomeCost = -1 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_BucketUnknown,
SUM(case when zip_ZIP_HousingMedianHomeCost < 0
and zip_ZIP_HousingMedianHomeCost <> -1 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_BucketError,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 0
AND zip_ZIP_HousingMedianHomeCost < 76000 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket0,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 76000
AND zip_ZIP_HousingMedianHomeCost < 90000 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket1,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 90000
AND zip_ZIP_HousingMedianHomeCost < 102200 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket2,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 102200
AND zip_ZIP_HousingMedianHomeCost < 120300 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket3,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 120300
AND zip_ZIP_HousingMedianHomeCost < 134500 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket4,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 134500
AND zip_ZIP_HousingMedianHomeCost < 155000 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket5,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 155000
AND zip_ZIP_HousingMedianHomeCost < 185500 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket6,
SUM(case when zip_ZIP_HousingMedianHomeCost >= 185500 then 1
else 0
end) as zip_ZIP_HousingMedianHomeCost_Bucket7,
SUM(case when zip_ZIP_HousingPropertyTaxRate IS null then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_BucketNullChars,
SUM(case when zip_ZIP_HousingPropertyTaxRate = -1 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_BucketUnknown,
SUM(case when zip_ZIP_HousingPropertyTaxRate < 0
and zip_ZIP_HousingPropertyTaxRate <> -1 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_BucketError,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 0
AND zip_ZIP_HousingPropertyTaxRate < 8.04 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket0,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 8.04
AND zip_ZIP_HousingPropertyTaxRate < 9 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket1,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 9
AND zip_ZIP_HousingPropertyTaxRate < 9.24 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket2,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 9.24
AND zip_ZIP_HousingPropertyTaxRate < 9.57 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket3,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 9.57
AND zip_ZIP_HousingPropertyTaxRate < 9.86 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket4,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 9.86
AND zip_ZIP_HousingPropertyTaxRate < 10.25 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket5,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 10.25
AND zip_ZIP_HousingPropertyTaxRate < 11.28 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket6,
SUM(case when zip_ZIP_HousingPropertyTaxRate >= 11.28 then 1
else 0
end) as zip_ZIP_HousingPropertyTaxRate_Bucket7,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 6
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 6
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 11
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 11
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 17
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 17
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 23
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 23
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 27
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 27
AND zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier < 33
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier >= 33
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1939orEarlier_Bucket6,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 4
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 4
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 5
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 5
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 6
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 6
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 7
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 7
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949 >= 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1940To1949_Bucket6,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 9
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 9
AND zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 10
AND zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 12
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 12
AND zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 < 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959 >= 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1950To1959_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 10
AND zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 11
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 11
AND zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 12
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 12
AND zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 < 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969 >= 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1960To1969_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 11
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 11
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 13
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 13
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 16
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 16
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 17
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 17
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 19
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 19
AND zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 < 21
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979 >= 21
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1970To1979_Bucket6,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 7
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 7
AND zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 10
AND zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 11
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 11
AND zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 13
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 13
AND zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 < 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989 >= 15
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1980To1989_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 4
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 4
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 5
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 5
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 7
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 7
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 9
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 9
AND zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994 >= 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1990To1994_Bucket6,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 5
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 5
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 6
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 6
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 7
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 7
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 10
AND zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 < 12
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998 >= 12
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1995To1998_Bucket6,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 IS null
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_BucketNullChars,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 = -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_BucketUnknown,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 0
and zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 <> -1
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_BucketError,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 0
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 5
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket0,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 5
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 8
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket1,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 8
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 9
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket2,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 9
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 10
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket3,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 10
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 12
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket4,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 12
AND zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 < 17
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket5,
SUM(case when zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008 >= 17
then 1
else 0
end) as zip_ZIP_HousingUnitsByYearStructureBuilt1999To2008_Bucket6,
SUM(case when zip_ZIP_HousingVacant IS null then 1
else 0
end) as zip_ZIP_HousingVacant_BucketNullChars,
SUM(case when zip_ZIP_HousingVacant = -1 then 1
else 0
end) as zip_ZIP_HousingVacant_BucketUnknown,
SUM(case when zip_ZIP_HousingVacant < 0
and zip_ZIP_HousingVacant <> -1 then 1
else 0
end) as zip_ZIP_HousingVacant_BucketError,
SUM(case when zip_ZIP_HousingVacant >= 0
AND zip_ZIP_HousingVacant < 5 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket0,
SUM(case when zip_ZIP_HousingVacant >= 5
AND zip_ZIP_HousingVacant < 6 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket1,
SUM(case when zip_ZIP_HousingVacant >= 6
AND zip_ZIP_HousingVacant < 7 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket2,
SUM(case when zip_ZIP_HousingVacant >= 7
AND zip_ZIP_HousingVacant < 8 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket3,
SUM(case when zip_ZIP_HousingVacant >= 8
AND zip_ZIP_HousingVacant < 10 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket4,
SUM(case when zip_ZIP_HousingVacant >= 10 then 1
else 0
end) as zip_ZIP_HousingVacant_Bucket5,
SUM(case when zip_ZIP_Latitude IS null then 1
else 0
end) as zip_ZIP_Latitude_BucketNullChars,
SUM(case when zip_ZIP_Latitude = -1 then 1
else 0
end) as zip_ZIP_Latitude_BucketUnknown,
SUM(case when zip_ZIP_Latitude < 0
and zip_ZIP_Latitude <> -1 then 1
else 0
end) as zip_ZIP_Latitude_BucketError,
SUM(case when zip_ZIP_Latitude >= 0
AND zip_ZIP_Latitude < 39 then 1
else 0
end) as zip_ZIP_Latitude_Bucket0,
SUM(case when zip_ZIP_Latitude >= 39
AND zip_ZIP_Latitude < 40 then 1
else 0
end) as zip_ZIP_Latitude_Bucket1,
SUM(case when zip_ZIP_Latitude >= 40
AND zip_ZIP_Latitude < 41 then 1
else 0
end) as zip_ZIP_Latitude_Bucket2,
SUM(case when zip_ZIP_Latitude >= 41
AND zip_ZIP_Latitude < 42 then 1
else 0
end) as zip_ZIP_Latitude_Bucket3,
SUM(case when zip_ZIP_Latitude >= 42 then 1
else 0
end) as zip_ZIP_Latitude_Bucket4,
SUM(case when zip_ZIP_Longitude IS null then 1
else 0
end) as zip_ZIP_Longitude_BucketNullChars,
SUM(case when zip_ZIP_Longitude = -1 then 1
else 0
end) as zip_ZIP_Longitude_BucketUnknown,
SUM(case when zip_ZIP_Longitude < 0
and zip_ZIP_Longitude <> -1 then 1
else 0
end) as zip_ZIP_Longitude_BucketError,
SUM(case when zip_ZIP_Longitude >= 0
AND zip_ZIP_Longitude < 86 then 1
else 0
end) as zip_ZIP_Longitude_Bucket0,
SUM(case when zip_ZIP_Longitude >= 86
AND zip_ZIP_Longitude < 87 then 1
else 0
end) as zip_ZIP_Longitude_Bucket1,
SUM(case when zip_ZIP_Longitude >= 87 then 1
else 0
end) as zip_ZIP_Longitude_Bucket2,
SUM(case when zip_ZIP_MalePopulation IS null then 1
else 0
end) as zip_ZIP_MalePopulation_BucketNullChars,
SUM(case when zip_ZIP_MalePopulation = -1 then 1
else 0
end) as zip_ZIP_MalePopulation_BucketUnknown,
SUM(case when zip_ZIP_MalePopulation < 0
and zip_ZIP_MalePopulation <> -1 then 1
else 0
end) as zip_ZIP_MalePopulation_BucketError,
SUM(case when zip_ZIP_MalePopulation >= 0
AND zip_ZIP_MalePopulation < 49 then 1
else 0
end) as zip_ZIP_MalePopulation_Bucket0,
SUM(case when zip_ZIP_MalePopulation >= 49
AND zip_ZIP_MalePopulation < 50 then 1
else 0
end) as zip_ZIP_MalePopulation_Bucket1,
SUM(case when zip_ZIP_MalePopulation >= 50
AND zip_ZIP_MalePopulation < 51 then 1
else 0
end) as zip_ZIP_MalePopulation_Bucket2,
SUM(case when zip_ZIP_MalePopulation >= 51 then 1
else 0
end) as zip_ZIP_MalePopulation_Bucket3,
SUM(case when zip_ZIP_MarriedPopulation IS null then 1
else 0
end) as zip_ZIP_MarriedPopulation_BucketNullChars,
SUM(case when zip_ZIP_MarriedPopulation = -1 then 1
else 0
end) as zip_ZIP_MarriedPopulation_BucketUnknown,
SUM(case when zip_ZIP_MarriedPopulation < 0
and zip_ZIP_MarriedPopulation <> -1 then 1
else 0
end) as zip_ZIP_MarriedPopulation_BucketError,
SUM(case when zip_ZIP_MarriedPopulation >= 0
AND zip_ZIP_MarriedPopulation < 59 then 1
else 0
end) as zip_ZIP_MarriedPopulation_Bucket0,
SUM(case when zip_ZIP_MarriedPopulation >= 59
AND zip_ZIP_MarriedPopulation < 62 then 1
else 0
end) as zip_ZIP_MarriedPopulation_Bucket1,
SUM(case when zip_ZIP_MarriedPopulation >= 62
AND zip_ZIP_MarriedPopulation < 64 then 1
else 0
end) as zip_ZIP_MarriedPopulation_Bucket2,
SUM(case when zip_ZIP_MarriedPopulation >= 64
AND zip_ZIP_MarriedPopulation < 67 then 1
else 0
end) as zip_ZIP_MarriedPopulation_Bucket3,
SUM(case when zip_ZIP_MarriedPopulation >= 67 then 1
else 0
end) as zip_ZIP_MarriedPopulation_Bucket4,
SUM(case when zip_ZIP_MarriedWithChildren IS null then 1
else 0
end) as zip_ZIP_MarriedWithChildren_BucketNullChars,
SUM(case when zip_ZIP_MarriedWithChildren = -1 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_BucketUnknown,
SUM(case when zip_ZIP_MarriedWithChildren < 0
and zip_ZIP_MarriedWithChildren <> -1 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_BucketError,
SUM(case when zip_ZIP_MarriedWithChildren >= 0
AND zip_ZIP_MarriedWithChildren < 88 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket0,
SUM(case when zip_ZIP_MarriedWithChildren >= 88
AND zip_ZIP_MarriedWithChildren < 92 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket1,
SUM(case when zip_ZIP_MarriedWithChildren >= 92
AND zip_ZIP_MarriedWithChildren < 96 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket2,
SUM(case when zip_ZIP_MarriedWithChildren >= 96
AND zip_ZIP_MarriedWithChildren < 98 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket3,
SUM(case when zip_ZIP_MarriedWithChildren >= 98
AND zip_ZIP_MarriedWithChildren < 99 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket4,
SUM(case when zip_ZIP_MarriedWithChildren >= 99 then 1
else 0
end) as zip_ZIP_MarriedWithChildren_Bucket5,
SUM(case when zip_ZIP_MedianAge IS null then 1
else 0
end) as zip_ZIP_MedianAge_BucketNullChars,
SUM(case when zip_ZIP_MedianAge = -1 then 1
else 0
end) as zip_ZIP_MedianAge_BucketUnknown,
SUM(case when zip_ZIP_MedianAge < 0
and zip_ZIP_MedianAge <> -1 then 1
else 0
end) as zip_ZIP_MedianAge_BucketError,
SUM(case when zip_ZIP_MedianAge >= 0
AND zip_ZIP_MedianAge < 36 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket0,
SUM(case when zip_ZIP_MedianAge >= 36
AND zip_ZIP_MedianAge < 37 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket1,
SUM(case when zip_ZIP_MedianAge >= 37
AND zip_ZIP_MedianAge < 38 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket2,
SUM(case when zip_ZIP_MedianAge >= 38
AND zip_ZIP_MedianAge < 39 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket3,
SUM(case when zip_ZIP_MedianAge >= 39
AND zip_ZIP_MedianAge < 40 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket4,
SUM(case when zip_ZIP_MedianAge >= 40 then 1
else 0
end) as zip_ZIP_MedianAge_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore < 1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore >= 1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue1000000orMore_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 20
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 20
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 25
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 25
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 28
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 28
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 30
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 30
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 34
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 34
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 < 37
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999 >= 37
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue100000To149999_Bucket6,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 8
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 8
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 10
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 10
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 13
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 13
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 17
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 17
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 < 21
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999 >= 21
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue150000To199999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 4
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 4
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 6
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 6
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 7
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 7
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 9
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 9
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 11
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 11
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 < 16
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999 >= 16
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue200000To299999_Bucket6,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 2
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 3
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 3
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 4
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 4
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 7
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 7
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 < 11
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999 >= 11
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue20000To39999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 < 1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 >= 1
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 >= 2
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 < 3
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 >= 3
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 < 5
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999 >= 5
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue300000To399999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 < 1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 >= 1
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999 >= 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue400000To499999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 2
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 4
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 4
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 6
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 6
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 8
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 8
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 11
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 11
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 < 16
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999 >= 16
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue40000To59999_Bucket6,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 < 1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 >= 1
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999 >= 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue500000To749999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 4
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 4
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 7
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 7
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 10
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 10
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 13
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 13
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 16
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 16
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 < 18
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999 >= 18
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue60000To79999_Bucket6,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 9
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 9
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 13
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 13
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 17
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 17
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 18
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 18
AND zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 < 21
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket4,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999 >= 21
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValue80000To99999_Bucket5,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 IS null
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_BucketNullChars,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 = -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_BucketUnknown,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 < 0
and zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 <> -1
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_BucketError,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 >= 0
AND zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 < 2
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_Bucket0,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 >= 2
AND zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 < 4
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_Bucket1,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 >= 4
AND zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 < 5
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_Bucket2,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 >= 5
AND zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 < 7
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_Bucket3,
SUM(case when zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000 >= 7
then 1
else 0
end) as zip_ZIP_OwnerOccupiedHousingUnitsByValueLessThan20000_Bucket4,
SUM(case when zip_ZIP_PeopleAsian IS null then 1
else 0
end) as zip_ZIP_PeopleAsian_BucketNullChars,
SUM(case when zip_ZIP_PeopleAsian = -1 then 1
else 0
end) as zip_ZIP_PeopleAsian_BucketUnknown,
SUM(case when zip_ZIP_PeopleAsian < 0
and zip_ZIP_PeopleAsian <> -1 then 1
else 0
end) as zip_ZIP_PeopleAsian_BucketError,
SUM(case when zip_ZIP_PeopleAsian >= 0
AND zip_ZIP_PeopleAsian < 1 then 1
else 0
end) as zip_ZIP_PeopleAsian_Bucket0,
SUM(case when zip_ZIP_PeopleAsian >= 1
AND zip_ZIP_PeopleAsian < 2 then 1
else 0
end) as zip_ZIP_PeopleAsian_Bucket1,
SUM(case when zip_ZIP_PeopleAsian >= 2 then 1
else 0
end) as zip_ZIP_PeopleAsian_Bucket2,
SUM(case when zip_ZIP_PeopleBlack IS null then 1
else 0
end) as zip_ZIP_PeopleBlack_BucketNullChars,
SUM(case when zip_ZIP_PeopleBlack = -1 then 1
else 0
end) as zip_ZIP_PeopleBlack_BucketUnknown,
SUM(case when zip_ZIP_PeopleBlack < 0
and zip_ZIP_PeopleBlack <> -1 then 1
else 0
end) as zip_ZIP_PeopleBlack_BucketError,
SUM(case when zip_ZIP_PeopleBlack >= 0
AND zip_ZIP_PeopleBlack < 1 then 1
else 0
end) as zip_ZIP_PeopleBlack_Bucket0,
SUM(case when zip_ZIP_PeopleBlack >= 1
AND zip_ZIP_PeopleBlack < 2 then 1
else 0
end) as zip_ZIP_PeopleBlack_Bucket1,
SUM(case when zip_ZIP_PeopleBlack >= 2
AND zip_ZIP_PeopleBlack < 3 then 1
else 0
end) as zip_ZIP_PeopleBlack_Bucket2,
SUM(case when zip_ZIP_PeopleBlack >= 3
AND zip_ZIP_PeopleBlack < 7 then 1
else 0
end) as zip_ZIP_PeopleBlack_Bucket3,
SUM(case when zip_ZIP_PeopleBlack >= 7 then 1
else 0
end) as zip_ZIP_PeopleBlack_Bucket4,
SUM(case when zip_ZIP_PeopleOther IS null then 1
else 0
end) as zip_ZIP_PeopleOther_BucketNullChars,
SUM(case when zip_ZIP_PeopleOther = -1 then 1
else 0
end) as zip_ZIP_PeopleOther_BucketUnknown,
SUM(case when zip_ZIP_PeopleOther < 0
and zip_ZIP_PeopleOther <> -1 then 1
else 0
end) as zip_ZIP_PeopleOther_BucketError,
SUM(case when zip_ZIP_PeopleOther >= 0
AND zip_ZIP_PeopleOther < 2 then 1
else 0
end) as zip_ZIP_PeopleOther_Bucket0,
SUM(case when zip_ZIP_PeopleOther >= 2
AND zip_ZIP_PeopleOther < 3 then 1
else 0
end) as zip_ZIP_PeopleOther_Bucket1,
SUM(case when zip_ZIP_PeopleOther >= 3
AND zip_ZIP_PeopleOther < 5 then 1
else 0
end) as zip_ZIP_PeopleOther_Bucket2,
SUM(case when zip_ZIP_PeopleOther >= 5 then 1
else 0
end) as zip_ZIP_PeopleOther_Bucket3,
SUM(case when zip_ZIP_PeopleWhite IS null then 1
else 0
end) as zip_ZIP_PeopleWhite_BucketNullChars,
SUM(case when zip_ZIP_PeopleWhite = -1 then 1
else 0
end) as zip_ZIP_PeopleWhite_BucketUnknown,
SUM(case when zip_ZIP_PeopleWhite < 0
and zip_ZIP_PeopleWhite <> -1 then 1
else 0
end) as zip_ZIP_PeopleWhite_BucketError,
SUM(case when zip_ZIP_PeopleWhite >= 0
AND zip_ZIP_PeopleWhite < 88 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket0,
SUM(case when zip_ZIP_PeopleWhite >= 88
AND zip_ZIP_PeopleWhite < 92 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket1,
SUM(case when zip_ZIP_PeopleWhite >= 92
AND zip_ZIP_PeopleWhite < 96 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket2,
SUM(case when zip_ZIP_PeopleWhite >= 96
AND zip_ZIP_PeopleWhite < 98 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket3,
SUM(case when zip_ZIP_PeopleWhite >= 98
AND zip_ZIP_PeopleWhite < 99 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket4,
SUM(case when zip_ZIP_PeopleWhite >= 99 then 1
else 0
end) as zip_ZIP_PeopleWhite_Bucket5,
SUM(case when zip_ZIP_PeopleWhiteHispanic IS null then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_BucketNullChars,
SUM(case when zip_ZIP_PeopleWhiteHispanic = -1 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_BucketUnknown,
SUM(case when zip_ZIP_PeopleWhiteHispanic < 0
and zip_ZIP_PeopleWhiteHispanic <> -1 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_BucketError,
SUM(case when zip_ZIP_PeopleWhiteHispanic >= 0
AND zip_ZIP_PeopleWhiteHispanic < 2 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_Bucket0,
SUM(case when zip_ZIP_PeopleWhiteHispanic >= 2
AND zip_ZIP_PeopleWhiteHispanic < 3 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_Bucket1,
SUM(case when zip_ZIP_PeopleWhiteHispanic >= 3
AND zip_ZIP_PeopleWhiteHispanic < 4 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_Bucket2,
SUM(case when zip_ZIP_PeopleWhiteHispanic >= 4
AND zip_ZIP_PeopleWhiteHispanic < 6 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_Bucket3,
SUM(case when zip_ZIP_PeopleWhiteHispanic >= 6 then 1
else 0
end) as zip_ZIP_PeopleWhiteHispanic_Bucket4,
SUM(case when zip_ZIP_Pop_Decrease IS null then 1
else 0
end) as zip_ZIP_Pop_Decrease_BucketNullChars,
SUM(case when zip_ZIP_Pop_Decrease = -1 then 1
else 0
end) as zip_ZIP_Pop_Decrease_BucketUnknown,
SUM(case when zip_ZIP_Pop_Decrease < 0
and zip_ZIP_Pop_Decrease <> -1 then 1
else 0
end) as zip_ZIP_Pop_Decrease_BucketError,
SUM(case when zip_ZIP_Pop_Decrease >= 0
AND zip_ZIP_Pop_Decrease < 1 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket0,
SUM(case when zip_ZIP_Pop_Decrease >= 1
AND zip_ZIP_Pop_Decrease < 2 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket1,
SUM(case when zip_ZIP_Pop_Decrease >= 2
AND zip_ZIP_Pop_Decrease < 3 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket2,
SUM(case when zip_ZIP_Pop_Decrease >= 3
AND zip_ZIP_Pop_Decrease < 4 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket3,
SUM(case when zip_ZIP_Pop_Decrease >= 4
AND zip_ZIP_Pop_Decrease < 5 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket4,
SUM(case when zip_ZIP_Pop_Decrease >= 5 then 1
else 0
end) as zip_ZIP_Pop_Decrease_Bucket5,
SUM(case when zip_ZIP_Pop_Increase IS null then 1
else 0
end) as zip_ZIP_Pop_Increase_BucketNullChars,
SUM(case when zip_ZIP_Pop_Increase = -1 then 1
else 0
end) as zip_ZIP_Pop_Increase_BucketUnknown,
SUM(case when zip_ZIP_Pop_Increase < 0
and zip_ZIP_Pop_Increase <> -1 then 1
else 0
end) as zip_ZIP_Pop_Increase_BucketError,
SUM(case when zip_ZIP_Pop_Increase >= 0
AND zip_ZIP_Pop_Increase < 2 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket0,
SUM(case when zip_ZIP_Pop_Increase >= 2
AND zip_ZIP_Pop_Increase < 4 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket1,
SUM(case when zip_ZIP_Pop_Increase >= 4
AND zip_ZIP_Pop_Increase < 6 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket2,
SUM(case when zip_ZIP_Pop_Increase >= 6
AND zip_ZIP_Pop_Increase < 7 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket3,
SUM(case when zip_ZIP_Pop_Increase >= 7
AND zip_ZIP_Pop_Increase < 10 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket4,
SUM(case when zip_ZIP_Pop_Increase >= 10
AND zip_ZIP_Pop_Increase < 20 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket5,
SUM(case when zip_ZIP_Pop_Increase >= 20 then 1
else 0
end) as zip_ZIP_Pop_Increase_Bucket6,
SUM(case when zip_ZIP_PopDensity IS null then 1
else 0
end) as zip_ZIP_PopDensity_BucketNullChars,
SUM(case when zip_ZIP_PopDensity = -1 then 1
else 0
end) as zip_ZIP_PopDensity_BucketUnknown,
SUM(case when zip_ZIP_PopDensity < 0
and zip_ZIP_PopDensity <> -1 then 1
else 0
end) as zip_ZIP_PopDensity_BucketError,
SUM(case when zip_ZIP_PopDensity >= 0
AND zip_ZIP_PopDensity < 46 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket0,
SUM(case when zip_ZIP_PopDensity >= 46
AND zip_ZIP_PopDensity < 65 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket1,
SUM(case when zip_ZIP_PopDensity >= 65
AND zip_ZIP_PopDensity < 95 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket2,
SUM(case when zip_ZIP_PopDensity >= 95
AND zip_ZIP_PopDensity < 123 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket3,
SUM(case when zip_ZIP_PopDensity >= 123
AND zip_ZIP_PopDensity < 161 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket4,
SUM(case when zip_ZIP_PopDensity >= 161
AND zip_ZIP_PopDensity < 300 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket5,
SUM(case when zip_ZIP_PopDensity >= 300
AND zip_ZIP_PopDensity < 1087 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket6,
SUM(case when zip_ZIP_PopDensity >= 1087 then 1
else 0
end) as zip_ZIP_PopDensity_Bucket7,
SUM(case when zip_ZIP_Population IS null then 1
else 0
end) as zip_ZIP_Population_BucketNullChars,
SUM(case when zip_ZIP_Population = -1 then 1
else 0
end) as zip_ZIP_Population_BucketUnknown,
SUM(case when zip_ZIP_Population < 0
and zip_ZIP_Population <> -1 then 1
else 0
end) as zip_ZIP_Population_BucketError,
SUM(case when zip_ZIP_Population >= 0
AND zip_ZIP_Population < 2401 then 1
else 0
end) as zip_ZIP_Population_Bucket0,
SUM(case when zip_ZIP_Population >= 2401
AND zip_ZIP_Population < 4418 then 1
else 0
end) as zip_ZIP_Population_Bucket1,
SUM(case when zip_ZIP_Population >= 4418
AND zip_ZIP_Population < 7907 then 1
else 0
end) as zip_ZIP_Population_Bucket2,
SUM(case when zip_ZIP_Population >= 7907
AND zip_ZIP_Population < 15036 then 1
else 0
end) as zip_ZIP_Population_Bucket3,
SUM(case when zip_ZIP_Population >= 15036
AND zip_ZIP_Population < 25567 then 1
else 0
end) as zip_ZIP_Population_Bucket4,
SUM(case when zip_ZIP_Population >= 25567
AND zip_ZIP_Population < 32312 then 1
else 0
end) as zip_ZIP_Population_Bucket5,
SUM(case when zip_ZIP_Population >= 32312 then 1
else 0
end) as zip_ZIP_Population_Bucket6,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance = -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 0
and zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 0
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 9
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 9
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 10
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 10
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 11
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 11
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 12
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 12
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 13
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 13
AND zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance < 15
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket5,
SUM(case when zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance >= 15
then 1
else 0
end) as zip_ZIP_PopulationByOccupationConstructionExtractionAndMaintenance_Bucket6,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry = -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry < 0
and zip_ZIP_PopulationByOccupationFarmingFishingAndForestry <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry >= 0
AND zip_ZIP_PopulationByOccupationFarmingFishingAndForestry < 1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry >= 1
AND zip_ZIP_PopulationByOccupationFarmingFishingAndForestry < 2
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationFarmingFishingAndForestry >= 2
then 1
else 0
end) as zip_ZIP_PopulationByOccupationFarmingFishingAndForestry_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations = -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 0
and zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 0
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 8
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 8
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 9
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 9
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 10
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 10
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 11
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 11
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 12
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 12
AND zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations < 14
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket5,
SUM(case when zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations >= 14
then 1
else 0
end) as zip_ZIP_PopulationByOccupationManagementBusinessAndFinancialOperations_Bucket6,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving = -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 0
and zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 0
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 15
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 15
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 19
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 19
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 23
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 23
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 27
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 27
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 31
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 31
AND zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving < 34
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket5,
SUM(case when zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving >= 34
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProductionTransportationAndMaterialMoving_Bucket6,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations = -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 0
and zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 0
AND zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 12
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 12
AND zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 14
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 14
AND zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 16
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 16
AND zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 18
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 18
AND zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations < 21
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations >= 21
then 1
else 0
end) as zip_ZIP_PopulationByOccupationProfessionalAndRelatedOccupations_Bucket5,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice IS null
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice = -1 then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice < 0
and zip_ZIP_PopulationByOccupationSalesAndOffice <> -1
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 0
AND zip_ZIP_PopulationByOccupationSalesAndOffice < 20
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 20
AND zip_ZIP_PopulationByOccupationSalesAndOffice < 23
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 23
AND zip_ZIP_PopulationByOccupationSalesAndOffice < 25
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 25
AND zip_ZIP_PopulationByOccupationSalesAndOffice < 27
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 27
AND zip_ZIP_PopulationByOccupationSalesAndOffice < 29
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationSalesAndOffice >= 29
then 1
else 0
end) as zip_ZIP_PopulationByOccupationSalesAndOffice_Bucket5,
SUM(case when zip_ZIP_PopulationByOccupationService IS null then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_BucketNullChars,
SUM(case when zip_ZIP_PopulationByOccupationService = -1 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_BucketUnknown,
SUM(case when zip_ZIP_PopulationByOccupationService < 0
and zip_ZIP_PopulationByOccupationService <> -1 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_BucketError,
SUM(case when zip_ZIP_PopulationByOccupationService >= 0
AND zip_ZIP_PopulationByOccupationService < 12 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket0,
SUM(case when zip_ZIP_PopulationByOccupationService >= 12
AND zip_ZIP_PopulationByOccupationService < 13 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket1,
SUM(case when zip_ZIP_PopulationByOccupationService >= 13
AND zip_ZIP_PopulationByOccupationService < 14 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket2,
SUM(case when zip_ZIP_PopulationByOccupationService >= 14
AND zip_ZIP_PopulationByOccupationService < 15 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket3,
SUM(case when zip_ZIP_PopulationByOccupationService >= 15
AND zip_ZIP_PopulationByOccupationService < 17 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket4,
SUM(case when zip_ZIP_PopulationByOccupationService >= 17 then 1
else 0
end) as zip_ZIP_PopulationByOccupationService_Bucket5,
SUM(case when zip_ZIP_PropertyCrime IS null then 1
else 0
end) as zip_ZIP_PropertyCrime_BucketNullChars,
SUM(case when zip_ZIP_PropertyCrime = -1 then 1
else 0
end) as zip_ZIP_PropertyCrime_BucketUnknown,
SUM(case when zip_ZIP_PropertyCrime < 0
and zip_ZIP_PropertyCrime <> -1 then 1
else 0
end) as zip_ZIP_PropertyCrime_BucketError,
SUM(case when zip_ZIP_PropertyCrime >= 0
AND zip_ZIP_PropertyCrime < 2 then 1
else 0
end) as zip_ZIP_PropertyCrime_Bucket0,
SUM(case when zip_ZIP_PropertyCrime >= 2
AND zip_ZIP_PropertyCrime < 3 then 1
else 0
end) as zip_ZIP_PropertyCrime_Bucket1,
SUM(case when zip_ZIP_PropertyCrime >= 3
AND zip_ZIP_PropertyCrime < 4 then 1
else 0
end) as zip_ZIP_PropertyCrime_Bucket2,
SUM(case when zip_ZIP_PropertyCrime >= 4
AND zip_ZIP_PropertyCrime < 6 then 1
else 0
end) as zip_ZIP_PropertyCrime_Bucket3,
SUM(case when zip_ZIP_PropertyCrime >= 6 then 1
else 0
end) as zip_ZIP_PropertyCrime_Bucket4,
SUM(case when zip_ZIP_ClimateAvgJanLow IS null then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_BucketNullChars,
SUM(case when zip_ZIP_ClimateAvgJanLow = -1 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_BucketUnknown,
SUM(case when zip_ZIP_ClimateAvgJanLow < 0
and zip_ZIP_ClimateAvgJanLow <> -1 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_BucketError,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 0
AND zip_ZIP_ClimateAvgJanLow < 16 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket0,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 16
AND zip_ZIP_ClimateAvgJanLow < 17 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket1,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 17
AND zip_ZIP_ClimateAvgJanLow < 18 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket2,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 18
AND zip_ZIP_ClimateAvgJanLow < 19 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket3,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 19
AND zip_ZIP_ClimateAvgJanLow < 22 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket4,
SUM(case when zip_ZIP_ClimateAvgJanLow >= 22 then 1
else 0
end) as zip_ZIP_ClimateAvgJanLow_Bucket5,
SUM(case when zip_ZIP_ClimateAvgJulyHigh IS null then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_BucketNullChars,
SUM(case when zip_ZIP_ClimateAvgJulyHigh = -1 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_BucketUnknown,
SUM(case when zip_ZIP_ClimateAvgJulyHigh < 0
and zip_ZIP_ClimateAvgJulyHigh <> -1 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_BucketError,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 0
AND zip_ZIP_ClimateAvgJulyHigh < 85 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket0,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 85
AND zip_ZIP_ClimateAvgJulyHigh < 86 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket1,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 86
AND zip_ZIP_ClimateAvgJulyHigh < 87 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket2,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 87
AND zip_ZIP_ClimateAvgJulyHigh < 88 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket3,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 88
AND zip_ZIP_ClimateAvgJulyHigh < 89 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket4,
SUM(case when zip_ZIP_ClimateAvgJulyHigh >= 89 then 1
else 0
end) as zip_ZIP_ClimateAvgJulyHigh_Bucket5,
SUM(case when zip_ZIP_ClimateComfortIndex IS null then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_BucketNullChars,
SUM(case when zip_ZIP_ClimateComfortIndex = -1 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_BucketUnknown,
SUM(case when zip_ZIP_ClimateComfortIndex < 0
and zip_ZIP_ClimateComfortIndex <> -1 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_BucketError,
SUM(case when zip_ZIP_ClimateComfortIndex >= 0
AND zip_ZIP_ClimateComfortIndex < 39 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket0,
SUM(case when zip_ZIP_ClimateComfortIndex >= 39
AND zip_ZIP_ClimateComfortIndex < 42 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket1,
SUM(case when zip_ZIP_ClimateComfortIndex >= 42
AND zip_ZIP_ClimateComfortIndex < 44 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket2,
SUM(case when zip_ZIP_ClimateComfortIndex >= 44
AND zip_ZIP_ClimateComfortIndex < 46 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket3,
SUM(case when zip_ZIP_ClimateComfortIndex >= 46
AND zip_ZIP_ClimateComfortIndex < 47 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket4,
SUM(case when zip_ZIP_ClimateComfortIndex >= 47 then 1
else 0
end) as zip_ZIP_ClimateComfortIndex_Bucket5,
SUM(case when zip_ZIP_ClimateElevationFt IS null then 1
else 0
end) as zip_ZIP_ClimateElevationFt_BucketNullChars,
SUM(case when zip_ZIP_ClimateElevationFt = -1 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_BucketUnknown,
SUM(case when zip_ZIP_ClimateElevationFt < 0
and zip_ZIP_ClimateElevationFt <> -1 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_BucketError,
SUM(case when zip_ZIP_ClimateElevationFt >= 0
AND zip_ZIP_ClimateElevationFt < 516 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket0,
SUM(case when zip_ZIP_ClimateElevationFt >= 516
AND zip_ZIP_ClimateElevationFt < 604 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket1,
SUM(case when zip_ZIP_ClimateElevationFt >= 604
AND zip_ZIP_ClimateElevationFt < 660 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket2,
SUM(case when zip_ZIP_ClimateElevationFt >= 660
AND zip_ZIP_ClimateElevationFt < 742 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket3,
SUM(case when zip_ZIP_ClimateElevationFt >= 742
AND zip_ZIP_ClimateElevationFt < 794 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket4,
SUM(case when zip_ZIP_ClimateElevationFt >= 794
AND zip_ZIP_ClimateElevationFt < 822 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket5,
SUM(case when zip_ZIP_ClimateElevationFt >= 822
AND zip_ZIP_ClimateElevationFt < 938 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket6,
SUM(case when zip_ZIP_ClimateElevationFt >= 938 then 1
else 0
end) as zip_ZIP_ClimateElevationFt_Bucket7,
SUM(case when zip_ZIP_ClimatePrecipitationDays IS null then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_BucketNullChars,
SUM(case when zip_ZIP_ClimatePrecipitationDays = -1 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_BucketUnknown,
SUM(case when zip_ZIP_ClimatePrecipitationDays < 0
and zip_ZIP_ClimatePrecipitationDays <> -1 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_BucketError,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 0
AND zip_ZIP_ClimatePrecipitationDays < 100 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket0,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 100
AND zip_ZIP_ClimatePrecipitationDays < 107 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket1,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 107
AND zip_ZIP_ClimatePrecipitationDays < 111 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket2,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 111
AND zip_ZIP_ClimatePrecipitationDays < 116 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket3,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 116
AND zip_ZIP_ClimatePrecipitationDays < 119 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket4,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 119
AND zip_ZIP_ClimatePrecipitationDays < 130 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket5,
SUM(case when zip_ZIP_ClimatePrecipitationDays >= 130 then 1
else 0
end) as zip_ZIP_ClimatePrecipitationDays_Bucket6,
SUM(case when zip_ZIP_ClimateRainfall IS null then 1
else 0
end) as zip_ZIP_ClimateRainfall_BucketNullChars,
SUM(case when zip_ZIP_ClimateRainfall = -1 then 1
else 0
end) as zip_ZIP_ClimateRainfall_BucketUnknown,
SUM(case when zip_ZIP_ClimateRainfall < 0
and zip_ZIP_ClimateRainfall <> -1 then 1
else 0
end) as zip_ZIP_ClimateRainfall_BucketError,
SUM(case when zip_ZIP_ClimateRainfall >= 0
AND zip_ZIP_ClimateRainfall < 37 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket0,
SUM(case when zip_ZIP_ClimateRainfall >= 37
AND zip_ZIP_ClimateRainfall < 39 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket1,
SUM(case when zip_ZIP_ClimateRainfall >= 39
AND zip_ZIP_ClimateRainfall < 41 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket2,
SUM(case when zip_ZIP_ClimateRainfall >= 41
AND zip_ZIP_ClimateRainfall < 43 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket3,
SUM(case when zip_ZIP_ClimateRainfall >= 43
AND zip_ZIP_ClimateRainfall < 45 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket4,
SUM(case when zip_ZIP_ClimateRainfall >= 45 then 1
else 0
end) as zip_ZIP_ClimateRainfall_Bucket5,
SUM(case when zip_ZIP_ClimateSnowfall IS null then 1
else 0
end) as zip_ZIP_ClimateSnowfall_BucketNullChars,
SUM(case when zip_ZIP_ClimateSnowfall = -1 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_BucketUnknown,
SUM(case when zip_ZIP_ClimateSnowfall < 0
and zip_ZIP_ClimateSnowfall <> -1 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_BucketError,
SUM(case when zip_ZIP_ClimateSnowfall >= 0
AND zip_ZIP_ClimateSnowfall < 11 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket0,
SUM(case when zip_ZIP_ClimateSnowfall >= 11
AND zip_ZIP_ClimateSnowfall < 14 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket1,
SUM(case when zip_ZIP_ClimateSnowfall >= 14
AND zip_ZIP_ClimateSnowfall < 16 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket2,
SUM(case when zip_ZIP_ClimateSnowfall >= 16
AND zip_ZIP_ClimateSnowfall < 19 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket3,
SUM(case when zip_ZIP_ClimateSnowfall >= 19
AND zip_ZIP_ClimateSnowfall < 22 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket4,
SUM(case when zip_ZIP_ClimateSnowfall >= 22
AND zip_ZIP_ClimateSnowfall < 25 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket5,
SUM(case when zip_ZIP_ClimateSnowfall >= 25
AND zip_ZIP_ClimateSnowfall < 29 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket6,
SUM(case when zip_ZIP_ClimateSnowfall >= 29 then 1
else 0
end) as zip_ZIP_ClimateSnowfall_Bucket7,
SUM(case when zip_ZIP_ClimateSunnyDays IS null then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_BucketNullChars,
SUM(case when zip_ZIP_ClimateSunnyDays = -1 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_BucketUnknown,
SUM(case when zip_ZIP_ClimateSunnyDays < 0
and zip_ZIP_ClimateSunnyDays <> -1 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_BucketError,
SUM(case when zip_ZIP_ClimateSunnyDays >= 0
AND zip_ZIP_ClimateSunnyDays < 174 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket0,
SUM(case when zip_ZIP_ClimateSunnyDays >= 174
AND zip_ZIP_ClimateSunnyDays < 180 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket1,
SUM(case when zip_ZIP_ClimateSunnyDays >= 180
AND zip_ZIP_ClimateSunnyDays < 181 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket2,
SUM(case when zip_ZIP_ClimateSunnyDays >= 181
AND zip_ZIP_ClimateSunnyDays < 190 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket3,
SUM(case when zip_ZIP_ClimateSunnyDays >= 190
AND zip_ZIP_ClimateSunnyDays < 196 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket4,
SUM(case when zip_ZIP_ClimateSunnyDays >= 196 then 1
else 0
end) as zip_ZIP_ClimateSunnyDays_Bucket5,
SUM(case when zip_ZIP_CostofLivingFood IS null then 1
else 0
end) as zip_ZIP_CostofLivingFood_BucketNullChars,
SUM(case when zip_ZIP_CostofLivingFood = -1 then 1
else 0
end) as zip_ZIP_CostofLivingFood_BucketUnknown,
SUM(case when zip_ZIP_CostofLivingFood < 0
and zip_ZIP_CostofLivingFood <> -1 then 1
else 0
end) as zip_ZIP_CostofLivingFood_BucketError,
SUM(case when zip_ZIP_CostofLivingFood >= 0
AND zip_ZIP_CostofLivingFood < 94 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket0,
SUM(case when zip_ZIP_CostofLivingFood >= 94
AND zip_ZIP_CostofLivingFood < 95 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket1,
SUM(case when zip_ZIP_CostofLivingFood >= 95
AND zip_ZIP_CostofLivingFood < 96 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket2,
SUM(case when zip_ZIP_CostofLivingFood >= 96
AND zip_ZIP_CostofLivingFood < 97 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket3,
SUM(case when zip_ZIP_CostofLivingFood >= 97
AND zip_ZIP_CostofLivingFood < 100 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket4,
SUM(case when zip_ZIP_CostofLivingFood >= 100 then 1
else 0
end) as zip_ZIP_CostofLivingFood_Bucket5,
SUM(case when zip_ZIP_CostofLivingMiscellaneous IS null then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_BucketNullChars,
SUM(case when zip_ZIP_CostofLivingMiscellaneous = -1 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_BucketUnknown,
SUM(case when zip_ZIP_CostofLivingMiscellaneous < 0
and zip_ZIP_CostofLivingMiscellaneous <> -1 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_BucketError,
SUM(case when zip_ZIP_CostofLivingMiscellaneous >= 0
AND zip_ZIP_CostofLivingMiscellaneous < 94 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_Bucket0,
SUM(case when zip_ZIP_CostofLivingMiscellaneous >= 94
AND zip_ZIP_CostofLivingMiscellaneous < 96 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_Bucket1,
SUM(case when zip_ZIP_CostofLivingMiscellaneous >= 96
AND zip_ZIP_CostofLivingMiscellaneous < 99 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_Bucket2,
SUM(case when zip_ZIP_CostofLivingMiscellaneous >= 99
AND zip_ZIP_CostofLivingMiscellaneous < 101 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_Bucket3,
SUM(case when zip_ZIP_CostofLivingMiscellaneous >= 101 then 1
else 0
end) as zip_ZIP_CostofLivingMiscellaneous_Bucket4,
SUM(case when zip_ZIP_CostofLivingOverall IS null then 1
else 0
end) as zip_ZIP_CostofLivingOverall_BucketNullChars,
SUM(case when zip_ZIP_CostofLivingOverall = -1 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_BucketUnknown,
SUM(case when zip_ZIP_CostofLivingOverall < 0
and zip_ZIP_CostofLivingOverall <> -1 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_BucketError,
SUM(case when zip_ZIP_CostofLivingOverall >= 0
AND zip_ZIP_CostofLivingOverall < 70 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket0,
SUM(case when zip_ZIP_CostofLivingOverall >= 70
AND zip_ZIP_CostofLivingOverall < 73 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket1,
SUM(case when zip_ZIP_CostofLivingOverall >= 73
AND zip_ZIP_CostofLivingOverall < 75 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket2,
SUM(case when zip_ZIP_CostofLivingOverall >= 75
AND zip_ZIP_CostofLivingOverall < 77 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket3,
SUM(case when zip_ZIP_CostofLivingOverall >= 77
AND zip_ZIP_CostofLivingOverall < 80 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket4,
SUM(case when zip_ZIP_CostofLivingOverall >= 80
AND zip_ZIP_CostofLivingOverall < 87 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket5,
SUM(case when zip_ZIP_CostofLivingOverall >= 87 then 1
else 0
end) as zip_ZIP_CostofLivingOverall_Bucket6,
SUM(case when zip_ZIP_CostofLivingUtilities IS null then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_BucketNullChars,
SUM(case when zip_ZIP_CostofLivingUtilities = -1 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_BucketUnknown,
SUM(case when zip_ZIP_CostofLivingUtilities < 0
and zip_ZIP_CostofLivingUtilities <> -1 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_BucketError,
SUM(case when zip_ZIP_CostofLivingUtilities >= 0
AND zip_ZIP_CostofLivingUtilities < 91 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket0,
SUM(case when zip_ZIP_CostofLivingUtilities >= 91
AND zip_ZIP_CostofLivingUtilities < 95 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket1,
SUM(case when zip_ZIP_CostofLivingUtilities >= 95
AND zip_ZIP_CostofLivingUtilities < 98 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket2,
SUM(case when zip_ZIP_CostofLivingUtilities >= 98
AND zip_ZIP_CostofLivingUtilities < 99 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket3,
SUM(case when zip_ZIP_CostofLivingUtilities >= 99
AND zip_ZIP_CostofLivingUtilities < 102 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket4,
SUM(case when zip_ZIP_CostofLivingUtilities >= 102
AND zip_ZIP_CostofLivingUtilities < 108 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket5,
SUM(case when zip_ZIP_CostofLivingUtilities >= 108 then 1
else 0
end) as zip_ZIP_CostofLivingUtilities_Bucket6,
SUM(case when zip_ZIP_EconomyFutureJobDecrease IS null then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_BucketNullChars,
SUM(case when zip_ZIP_EconomyFutureJobDecrease = -1 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_BucketUnknown,
SUM(case when zip_ZIP_EconomyFutureJobDecrease < 0
and zip_ZIP_EconomyFutureJobDecrease <> -1 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_BucketError,
SUM(case when zip_ZIP_EconomyFutureJobDecrease >= 0
AND zip_ZIP_EconomyFutureJobDecrease < 1 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_Bucket0,
SUM(case when zip_ZIP_EconomyFutureJobDecrease >= 1
AND zip_ZIP_EconomyFutureJobDecrease < 2 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_Bucket1,
SUM(case when zip_ZIP_EconomyFutureJobDecrease >= 2
AND zip_ZIP_EconomyFutureJobDecrease < 4 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_Bucket2,
SUM(case when zip_ZIP_EconomyFutureJobDecrease >= 4
AND zip_ZIP_EconomyFutureJobDecrease < 11 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_Bucket3,
SUM(case when zip_ZIP_EconomyFutureJobDecrease >= 11 then 1
else 0
end) as zip_ZIP_EconomyFutureJobDecrease_Bucket4,
SUM(case when zip_ZIP_EconomyFutureJobIncrease IS null then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_BucketNullChars,
SUM(case when zip_ZIP_EconomyFutureJobIncrease = -1 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_BucketUnknown,
SUM(case when zip_ZIP_EconomyFutureJobIncrease < 0
and zip_ZIP_EconomyFutureJobIncrease <> -1 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_BucketError,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 0
AND zip_ZIP_EconomyFutureJobIncrease < 9 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket0,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 9
AND zip_ZIP_EconomyFutureJobIncrease < 13 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket1,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 13
AND zip_ZIP_EconomyFutureJobIncrease < 14 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket2,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 14
AND zip_ZIP_EconomyFutureJobIncrease < 15 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket3,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 15
AND zip_ZIP_EconomyFutureJobIncrease < 16 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket4,
SUM(case when zip_ZIP_EconomyFutureJobIncrease >= 16 then 1
else 0
end) as zip_ZIP_EconomyFutureJobIncrease_Bucket5,
SUM(case when zip_ZIP_EconomyHouseholdIncome IS null then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_BucketNullChars,
SUM(case when zip_ZIP_EconomyHouseholdIncome = -1 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_BucketUnknown,
SUM(case when zip_ZIP_EconomyHouseholdIncome < 0
and zip_ZIP_EconomyHouseholdIncome <> -1 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_BucketError,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 0
AND zip_ZIP_EconomyHouseholdIncome < 38713 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket0,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 38713
AND zip_ZIP_EconomyHouseholdIncome < 43335 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket1,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 43335
AND zip_ZIP_EconomyHouseholdIncome < 44884 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket2,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 44884
AND zip_ZIP_EconomyHouseholdIncome < 46963 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket3,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 46963
AND zip_ZIP_EconomyHouseholdIncome < 49285 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket4,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 49285
AND zip_ZIP_EconomyHouseholdIncome < 53203 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket5,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 53203
AND zip_ZIP_EconomyHouseholdIncome < 61710 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket6,
SUM(case when zip_ZIP_EconomyHouseholdIncome >= 61710 then 1
else 0
end) as zip_ZIP_EconomyHouseholdIncome_Bucket7,
SUM(case when zip_ZIP_EconomyIncomePerCap IS null then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_BucketNullChars,
SUM(case when zip_ZIP_EconomyIncomePerCap = -1 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_BucketUnknown,
SUM(case when zip_ZIP_EconomyIncomePerCap < 0
and zip_ZIP_EconomyIncomePerCap <> -1 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_BucketError,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 0
AND zip_ZIP_EconomyIncomePerCap < 19573 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket0,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 19573
AND zip_ZIP_EconomyIncomePerCap < 20625 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket1,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 20625
AND zip_ZIP_EconomyIncomePerCap < 21631 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket2,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 21631
AND zip_ZIP_EconomyIncomePerCap < 23062 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket3,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 23062
AND zip_ZIP_EconomyIncomePerCap < 24197 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket4,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 24197
AND zip_ZIP_EconomyIncomePerCap < 27934 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket5,
SUM(case when zip_ZIP_EconomyIncomePerCap >= 27934 then 1
else 0
end) as zip_ZIP_EconomyIncomePerCap_Bucket6,
SUM(case when zip_ZIP_EconomyIncomeTaxes IS null then 1
else 0
end) as zip_ZIP_EconomyIncomeTaxes_BucketNullChars,
SUM(case when zip_ZIP_EconomyIncomeTaxes = -1 then 1
else 0
end) as zip_ZIP_EconomyIncomeTaxes_BucketUnknown,
SUM(case when zip_ZIP_EconomyIncomeTaxes < 0
and zip_ZIP_EconomyIncomeTaxes <> -1 then 1
else 0
end) as zip_ZIP_EconomyIncomeTaxes_BucketError,
SUM(case when zip_ZIP_EconomyIncomeTaxes >= 0
AND zip_ZIP_EconomyIncomeTaxes < 4 then 1
else 0
end) as zip_ZIP_EconomyIncomeTaxes_Bucket0,
SUM(case when zip_ZIP_EconomyIncomeTaxes >= 4 then 1
else 0
end) as zip_ZIP_EconomyIncomeTaxes_Bucket1,
SUM(case when zip_ZIP_EconomyRecentJobDecrease IS null then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_BucketNullChars,
SUM(case when zip_ZIP_EconomyRecentJobDecrease = -1 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_BucketUnknown,
SUM(case when zip_ZIP_EconomyRecentJobDecrease < 0
and zip_ZIP_EconomyRecentJobDecrease <> -1 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_BucketError,
SUM(case when zip_ZIP_EconomyRecentJobDecrease >= 0
AND zip_ZIP_EconomyRecentJobDecrease < 1 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_Bucket0,
SUM(case when zip_ZIP_EconomyRecentJobDecrease >= 1
AND zip_ZIP_EconomyRecentJobDecrease < 2 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_Bucket1,
SUM(case when zip_ZIP_EconomyRecentJobDecrease >= 2
AND zip_ZIP_EconomyRecentJobDecrease < 3 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_Bucket2,
SUM(case when zip_ZIP_EconomyRecentJobDecrease >= 3 then 1
else 0
end) as zip_ZIP_EconomyRecentJobDecrease_Bucket3,
SUM(case when zip_ZIP_EconomyUnemploymentRate IS null then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_BucketNullChars,
SUM(case when zip_ZIP_EconomyUnemploymentRate = -1 then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_BucketUnknown,
SUM(case when zip_ZIP_EconomyUnemploymentRate < 0
and zip_ZIP_EconomyUnemploymentRate <> -1 then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_BucketError,
SUM(case when zip_ZIP_EconomyUnemploymentRate >= 0
AND zip_ZIP_EconomyUnemploymentRate < 4 then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_Bucket0,
SUM(case when zip_ZIP_EconomyUnemploymentRate >= 4
AND zip_ZIP_EconomyUnemploymentRate < 5 then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_Bucket1,
SUM(case when zip_ZIP_EconomyUnemploymentRate >= 5 then 1
else 0
end) as zip_ZIP_EconomyUnemploymentRate_Bucket2,
SUM(case when zip_ZIP_Education2yrCollegeGrad IS null then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_BucketNullChars,
SUM(case when zip_ZIP_Education2yrCollegeGrad = -1 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_BucketUnknown,
SUM(case when zip_ZIP_Education2yrCollegeGrad < 0
and zip_ZIP_Education2yrCollegeGrad <> -1 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_BucketError,
SUM(case when zip_ZIP_Education2yrCollegeGrad >= 0
AND zip_ZIP_Education2yrCollegeGrad < 5 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_Bucket0,
SUM(case when zip_ZIP_Education2yrCollegeGrad >= 5
AND zip_ZIP_Education2yrCollegeGrad < 6 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_Bucket1,
SUM(case when zip_ZIP_Education2yrCollegeGrad >= 6
AND zip_ZIP_Education2yrCollegeGrad < 7 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_Bucket2,
SUM(case when zip_ZIP_Education2yrCollegeGrad >= 7
AND zip_ZIP_Education2yrCollegeGrad < 8 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_Bucket3,
SUM(case when zip_ZIP_Education2yrCollegeGrad >= 8 then 1
else 0
end) as zip_ZIP_Education2yrCollegeGrad_Bucket4,
SUM(case when zip_ZIP_Education4yrCollegeGrad IS null then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_BucketNullChars,
SUM(case when zip_ZIP_Education4yrCollegeGrad = -1 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_BucketUnknown,
SUM(case when zip_ZIP_Education4yrCollegeGrad < 0
and zip_ZIP_Education4yrCollegeGrad <> -1 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_BucketError,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 0
AND zip_ZIP_Education4yrCollegeGrad < 6 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket0,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 6
AND zip_ZIP_Education4yrCollegeGrad < 7 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket1,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 7
AND zip_ZIP_Education4yrCollegeGrad < 8 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket2,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 8
AND zip_ZIP_Education4yrCollegeGrad < 9 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket3,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 9
AND zip_ZIP_Education4yrCollegeGrad < 11 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket4,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 11
AND zip_ZIP_Education4yrCollegeGrad < 14 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket5,
SUM(case when zip_ZIP_Education4yrCollegeGrad >= 14 then 1
else 0
end) as zip_ZIP_Education4yrCollegeGrad_Bucket6,
SUM(case when zip_ZIP_EducationGraduateDegrees IS null then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_BucketNullChars,
SUM(case when zip_ZIP_EducationGraduateDegrees = -1 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_BucketUnknown,
SUM(case when zip_ZIP_EducationGraduateDegrees < 0
and zip_ZIP_EducationGraduateDegrees <> -1 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_BucketError,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 0
AND zip_ZIP_EducationGraduateDegrees < 4 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket0,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 4
AND zip_ZIP_EducationGraduateDegrees < 5 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket1,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 5
AND zip_ZIP_EducationGraduateDegrees < 6 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket2,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 6
AND zip_ZIP_EducationGraduateDegrees < 7 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket3,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 7
AND zip_ZIP_EducationGraduateDegrees < 9 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket4,
SUM(case when zip_ZIP_EducationGraduateDegrees >= 9 then 1
else 0
end) as zip_ZIP_EducationGraduateDegrees_Bucket5,
SUM(case when zip_ZIP_EducationHighSchoolGrads IS null then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_BucketNullChars,
SUM(case when zip_ZIP_EducationHighSchoolGrads = -1 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_BucketUnknown,
SUM(case when zip_ZIP_EducationHighSchoolGrads < 0
and zip_ZIP_EducationHighSchoolGrads <> -1 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_BucketError,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 0
AND zip_ZIP_EducationHighSchoolGrads < 77 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket0,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 77
AND zip_ZIP_EducationHighSchoolGrads < 79 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket1,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 79
AND zip_ZIP_EducationHighSchoolGrads < 81 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket2,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 81
AND zip_ZIP_EducationHighSchoolGrads < 83 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket3,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 83
AND zip_ZIP_EducationHighSchoolGrads < 87 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket4,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 87
AND zip_ZIP_EducationHighSchoolGrads < 90 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket5,
SUM(case when zip_ZIP_EducationHighSchoolGrads >= 90 then 1
else 0
end) as zip_ZIP_EducationHighSchoolGrads_Bucket6,
SUM(case when zip_ZIP_EducationPupilTeacherRatio IS null then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_BucketNullChars,
SUM(case when zip_ZIP_EducationPupilTeacherRatio = -1 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_BucketUnknown,
SUM(case when zip_ZIP_EducationPupilTeacherRatio < 0
and zip_ZIP_EducationPupilTeacherRatio <> -1 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_BucketError,
SUM(case when zip_ZIP_EducationPupilTeacherRatio >= 0
AND zip_ZIP_EducationPupilTeacherRatio < 17 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_Bucket0,
SUM(case when zip_ZIP_EducationPupilTeacherRatio >= 17
AND zip_ZIP_EducationPupilTeacherRatio < 18 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_Bucket1,
SUM(case when zip_ZIP_EducationPupilTeacherRatio >= 18
AND zip_ZIP_EducationPupilTeacherRatio < 19 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_Bucket2,
SUM(case when zip_ZIP_EducationPupilTeacherRatio >= 19
AND zip_ZIP_EducationPupilTeacherRatio < 21 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_Bucket3,
SUM(case when zip_ZIP_EducationPupilTeacherRatio >= 21 then 1
else 0
end) as zip_ZIP_EducationPupilTeacherRatio_Bucket4,
SUM(case when zip_ZIP_EducationSchoolExpend IS null then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_BucketNullChars,
SUM(case when zip_ZIP_EducationSchoolExpend = -1 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_BucketUnknown,
SUM(case when zip_ZIP_EducationSchoolExpend < 0
and zip_ZIP_EducationSchoolExpend <> -1 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_BucketError,
SUM(case when zip_ZIP_EducationSchoolExpend >= 0
AND zip_ZIP_EducationSchoolExpend < 5069 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket0,
SUM(case when zip_ZIP_EducationSchoolExpend >= 5069
AND zip_ZIP_EducationSchoolExpend < 5267 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket1,
SUM(case when zip_ZIP_EducationSchoolExpend >= 5267
AND zip_ZIP_EducationSchoolExpend < 5437 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket2,
SUM(case when zip_ZIP_EducationSchoolExpend >= 5437
AND zip_ZIP_EducationSchoolExpend < 5623 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket3,
SUM(case when zip_ZIP_EducationSchoolExpend >= 5623
AND zip_ZIP_EducationSchoolExpend < 5791 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket4,
SUM(case when zip_ZIP_EducationSchoolExpend >= 5791
AND zip_ZIP_EducationSchoolExpend < 6243 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket5,
SUM(case when zip_ZIP_EducationSchoolExpend >= 6243
AND zip_ZIP_EducationSchoolExpend < 6581 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket6,
SUM(case when zip_ZIP_EducationSchoolExpend >= 6581 then 1
else 0
end) as zip_ZIP_EducationSchoolExpend_Bucket7,
SUM(case when zip_ZIP_EducationStudentsPerCounselor IS null then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_BucketNullChars,
SUM(case when zip_ZIP_EducationStudentsPerCounselor = -1 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_BucketUnknown,
SUM(case when zip_ZIP_EducationStudentsPerCounselor < 0
and zip_ZIP_EducationStudentsPerCounselor <> -1 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_BucketError,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 0
AND zip_ZIP_EducationStudentsPerCounselor < 423 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket0,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 423
AND zip_ZIP_EducationStudentsPerCounselor < 467 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket1,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 467
AND zip_ZIP_EducationStudentsPerCounselor < 534 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket2,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 534
AND zip_ZIP_EducationStudentsPerCounselor < 587 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket3,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 587
AND zip_ZIP_EducationStudentsPerCounselor < 636 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket4,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 636
AND zip_ZIP_EducationStudentsPerCounselor < 701 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket5,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 701
AND zip_ZIP_EducationStudentsPerCounselor < 777 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket6,
SUM(case when zip_ZIP_EducationStudentsPerCounselor >= 777 then 1
else 0
end) as zip_ZIP_EducationStudentsPerCounselor_Bucket7,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian IS null then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_BucketNullChars,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian = -1 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_BucketUnknown,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian < 0
and zip_ZIP_EducationStudentsPerLibrarian <> -1 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_BucketError,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 0
AND zip_ZIP_EducationStudentsPerLibrarian < 339 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket0,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 339
AND zip_ZIP_EducationStudentsPerLibrarian < 366 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket1,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 366
AND zip_ZIP_EducationStudentsPerLibrarian < 395 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket2,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 395
AND zip_ZIP_EducationStudentsPerLibrarian < 434 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket3,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 434
AND zip_ZIP_EducationStudentsPerLibrarian < 461 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket4,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 461
AND zip_ZIP_EducationStudentsPerLibrarian < 524 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket5,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 524
AND zip_ZIP_EducationStudentsPerLibrarian < 636 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket6,
SUM(case when zip_ZIP_EducationStudentsPerLibrarian >= 636 then 1
else 0
end) as zip_ZIP_EducationStudentsPerLibrarian_Bucket7,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 0
and zip_ZIP_EstHouseholdIncomeBetween100KAnd150K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 6
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 6
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 7
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 7
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 8
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 8
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 9
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 9
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 10
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 10
AND zip_ZIP_EstHouseholdIncomeBetween100KAnd150K < 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween100KAnd150K >= 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween100KAnd150K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K < 0
and zip_ZIP_EstHouseholdIncomeBetween150KAnd250K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween150KAnd250K < 2
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K >= 2
AND zip_ZIP_EstHouseholdIncomeBetween150KAnd250K < 3
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K >= 3
AND zip_ZIP_EstHouseholdIncomeBetween150KAnd250K < 5
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween150KAnd250K >= 5 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween150KAnd250K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 0
and zip_ZIP_EstHouseholdIncomeBetween15KAnd25K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 8
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 8
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 10
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 10
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 12
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 12
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 13
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 13
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 14
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 14
AND zip_ZIP_EstHouseholdIncomeBetween15KAnd25K < 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween15KAnd25K >= 15 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween15KAnd25K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween250KAnd500K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween250KAnd500K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween250KAnd500K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween250KAnd500K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween250KAnd500K < 0
and zip_ZIP_EstHouseholdIncomeBetween250KAnd500K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween250KAnd500K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween250KAnd500K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween250KAnd500K < 1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween250KAnd500K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween250KAnd500K >= 1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween250KAnd500K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 0
and zip_ZIP_EstHouseholdIncomeBetween25KAnd35K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 10
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 10
AND zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 12
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 12
AND zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 13
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 13
AND zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 14
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 14
AND zip_ZIP_EstHouseholdIncomeBetween25KAnd35K < 16
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween25KAnd35K >= 16 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween25KAnd35K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 0
and zip_ZIP_EstHouseholdIncomeBetween35KAnd50K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 15
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 17
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 17
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 18
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 18
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 19
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 19
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 20
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 20
AND zip_ZIP_EstHouseholdIncomeBetween35KAnd50K < 21
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween35KAnd50K >= 21 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween35KAnd50K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 0
and zip_ZIP_EstHouseholdIncomeBetween50KAnd75K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 6
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 6
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 7
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 7
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 8
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 8
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 9
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 9
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 10
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 10
AND zip_ZIP_EstHouseholdIncomeBetween50KAnd75K < 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween50KAnd75K >= 15 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween50KAnd75K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K IS null
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 0
and zip_ZIP_EstHouseholdIncomeBetween75KAnd100K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 0
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 9
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 9
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 10
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 10
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 11
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 11
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 12
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 12
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 13
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 13
AND zip_ZIP_EstHouseholdIncomeBetween75KAnd100K < 15
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeBetween75KAnd100K >= 15 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeBetween75KAnd100K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeGreaterThan500K IS null then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeGreaterThan500K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeGreaterThan500K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeGreaterThan500K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeGreaterThan500K < 0
and zip_ZIP_EstHouseholdIncomeGreaterThan500K <> -1
then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeGreaterThan500K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeGreaterThan500K >= 0
AND zip_ZIP_EstHouseholdIncomeGreaterThan500K < 1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeGreaterThan500K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeGreaterThan500K >= 1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeGreaterThan500K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K IS null then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_BucketNullChars,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K = -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_BucketUnknown,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K < 0
and zip_ZIP_EstHouseholdIncomeLessThan15K <> -1 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_BucketError,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 0
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 7 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket0,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 7
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 9 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket1,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 9
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 10 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket2,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 10
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 12 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket3,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 12
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 13 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket4,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 13
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 15 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket5,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 15
AND zip_ZIP_EstHouseholdIncomeLessThan15K < 17 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket6,
SUM(case when zip_ZIP_EstHouseholdIncomeLessThan15K >= 17 then 1
else 0
end) as zip_ZIP_EstHouseholdIncomeLessThan15K_Bucket7,
SUM(case when zip_ZIP_FemalePopulation IS null then 1
else 0
end) as zip_ZIP_FemalePopulation_BucketNullChars,
SUM(case when zip_ZIP_FemalePopulation = -1 then 1
else 0
end) as zip_ZIP_FemalePopulation_BucketUnknown,
SUM(case when zip_ZIP_FemalePopulation < 0
and zip_ZIP_FemalePopulation <> -1 then 1
else 0
end) as zip_ZIP_FemalePopulation_BucketError,
SUM(case when zip_ZIP_FemalePopulation >= 0
AND zip_ZIP_FemalePopulation < 50 then 1
else 0
end) as zip_ZIP_FemalePopulation_Bucket0,
SUM(case when zip_ZIP_FemalePopulation >= 50
AND zip_ZIP_FemalePopulation < 51 then 1
else 0
end) as zip_ZIP_FemalePopulation_Bucket1,
SUM(case when zip_ZIP_FemalePopulation >= 51
AND zip_ZIP_FemalePopulation < 52 then 1
else 0
end) as zip_ZIP_FemalePopulation_Bucket2,
SUM(case when zip_ZIP_FemalePopulation >= 52 then 1
else 0
end) as zip_ZIP_FemalePopulation_Bucket3,
SUM(case when zip_ZIP_HealthAirQuality IS null then 1
else 0
end) as zip_ZIP_HealthAirQuality_BucketNullChars,
SUM(case when zip_ZIP_HealthAirQuality = -1 then 1
else 0
end) as zip_ZIP_HealthAirQuality_BucketUnknown,
SUM(case when zip_ZIP_HealthAirQuality < 0
and zip_ZIP_HealthAirQuality <> -1 then 1
else 0
end) as zip_ZIP_HealthAirQuality_BucketError,
SUM(case when zip_ZIP_HealthAirQuality >= 0
AND zip_ZIP_HealthAirQuality < 27 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket0,
SUM(case when zip_ZIP_HealthAirQuality >= 27
AND zip_ZIP_HealthAirQuality < 39 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket1,
SUM(case when zip_ZIP_HealthAirQuality >= 39
AND zip_ZIP_HealthAirQuality < 45 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket2,
SUM(case when zip_ZIP_HealthAirQuality >= 45
AND zip_ZIP_HealthAirQuality < 53 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket3,
SUM(case when zip_ZIP_HealthAirQuality >= 53
AND zip_ZIP_HealthAirQuality < 59 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket4,
SUM(case when zip_ZIP_HealthAirQuality >= 59
AND zip_ZIP_HealthAirQuality < 64 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket5,
SUM(case when zip_ZIP_HealthAirQuality >= 64
AND zip_ZIP_HealthAirQuality < 73 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket6,
SUM(case when zip_ZIP_HealthAirQuality >= 73 then 1
else 0
end) as zip_ZIP_HealthAirQuality_Bucket7,
SUM(case when zip_ZIP_HealthPhysiciansPer100k IS null then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_BucketNullChars,
SUM(case when zip_ZIP_HealthPhysiciansPer100k = -1 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_BucketUnknown,
SUM(case when zip_ZIP_HealthPhysiciansPer100k < 0
and zip_ZIP_HealthPhysiciansPer100k <> -1 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_BucketError,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 0
AND zip_ZIP_HealthPhysiciansPer100k < 50 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket0,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 50
AND zip_ZIP_HealthPhysiciansPer100k < 76 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket1,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 76
AND zip_ZIP_HealthPhysiciansPer100k < 106 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket2,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 106
AND zip_ZIP_HealthPhysiciansPer100k < 138 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket3,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 138
AND zip_ZIP_HealthPhysiciansPer100k < 180 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket4,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 180
AND zip_ZIP_HealthPhysiciansPer100k < 240 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket5,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 240
AND zip_ZIP_HealthPhysiciansPer100k < 304 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket6,
SUM(case when zip_ZIP_HealthPhysiciansPer100k >= 304 then 1
else 0
end) as zip_ZIP_HealthPhysiciansPer100k_Bucket7,
SUM(case when zip_ZIP_HealthSuperfundSites IS null then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_BucketNullChars,
SUM(case when zip_ZIP_HealthSuperfundSites = -1 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_BucketUnknown,
SUM(case when zip_ZIP_HealthSuperfundSites < 0
and zip_ZIP_HealthSuperfundSites <> -1 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_BucketError,
SUM(case when zip_ZIP_HealthSuperfundSites >= 0
AND zip_ZIP_HealthSuperfundSites < 29 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket0,
SUM(case when zip_ZIP_HealthSuperfundSites >= 29
AND zip_ZIP_HealthSuperfundSites < 42 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket1,
SUM(case when zip_ZIP_HealthSuperfundSites >= 42
AND zip_ZIP_HealthSuperfundSites < 88 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket2,
SUM(case when zip_ZIP_HealthSuperfundSites >= 88
AND zip_ZIP_HealthSuperfundSites < 96 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket3,
SUM(case when zip_ZIP_HealthSuperfundSites >= 96
AND zip_ZIP_HealthSuperfundSites < 99 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket4,
SUM(case when zip_ZIP_HealthSuperfundSites >= 99
AND zip_ZIP_HealthSuperfundSites < 100 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket5,
SUM(case when zip_ZIP_HealthSuperfundSites >= 100
AND zip_ZIP_HealthSuperfundSites < 101 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket6,
SUM(case when zip_ZIP_HealthSuperfundSites >= 101 then 1
else 0
end) as zip_ZIP_HealthSuperfundSites_Bucket7,
SUM(case when zip_ZIP_HealthWaterQuality IS null then 1
else 0
end) as zip_ZIP_HealthWaterQuality_BucketNullChars,
SUM(case when zip_ZIP_HealthWaterQuality = -1 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_BucketUnknown,
SUM(case when zip_ZIP_HealthWaterQuality < 0
and zip_ZIP_HealthWaterQuality <> -1 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_BucketError,
SUM(case when zip_ZIP_HealthWaterQuality >= 0
AND zip_ZIP_HealthWaterQuality < 13 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket0,
SUM(case when zip_ZIP_HealthWaterQuality >= 13
AND zip_ZIP_HealthWaterQuality < 27 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket1,
SUM(case when zip_ZIP_HealthWaterQuality >= 27
AND zip_ZIP_HealthWaterQuality < 30 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket2,
SUM(case when zip_ZIP_HealthWaterQuality >= 30
AND zip_ZIP_HealthWaterQuality < 31 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket3,
SUM(case when zip_ZIP_HealthWaterQuality >= 31
AND zip_ZIP_HealthWaterQuality < 37 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket4,
SUM(case when zip_ZIP_HealthWaterQuality >= 37
AND zip_ZIP_HealthWaterQuality < 45 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket5,
SUM(case when zip_ZIP_HealthWaterQuality >= 45
AND zip_ZIP_HealthWaterQuality < 60 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket6,
SUM(case when zip_ZIP_HealthWaterQuality >= 60 then 1
else 0
end) as zip_ZIP_HealthWaterQuality_Bucket7,
SUM(case when zip_ZIP_Households IS null then 1
else 0
end) as zip_ZIP_Households_BucketNullChars,
SUM(case when zip_ZIP_Households = -1 then 1
else 0
end) as zip_ZIP_Households_BucketUnknown,
SUM(case when zip_ZIP_Households < 0
and zip_ZIP_Households <> -1 then 1
else 0
end) as zip_ZIP_Households_BucketError,
SUM(case when zip_ZIP_Households >= 0
AND zip_ZIP_Households < 993 then 1
else 0
end) as zip_ZIP_Households_Bucket0,
SUM(case when zip_ZIP_Households >= 993
AND zip_ZIP_Households < 2511 then 1
else 0
end) as zip_ZIP_Households_Bucket1,
SUM(case when zip_ZIP_Households >= 2511
AND zip_ZIP_Households < 5688 then 1
else 0
end) as zip_ZIP_Households_Bucket2,
SUM(case when zip_ZIP_Households >= 5688
AND zip_ZIP_Households < 9436 then 1
else 0
end) as zip_ZIP_Households_Bucket3,
SUM(case when zip_ZIP_Households >= 9436
AND zip_ZIP_Households < 11453 then 1
else 0
end) as zip_ZIP_Households_Bucket4,
SUM(case when zip_ZIP_Households >= 11453
AND zip_ZIP_Households < 14856 then 1
else 0
end) as zip_ZIP_Households_Bucket5,
SUM(case when zip_ZIP_Households >= 14856 then 1
else 0
end) as zip_ZIP_Households_Bucket6,
SUM(case when zip_ZIP_HouseholdSize IS null then 1
else 0
end) as zip_ZIP_HouseholdSize_BucketNullChars,
SUM(case when zip_ZIP_HouseholdSize = -1 then 1
else 0
end) as zip_ZIP_HouseholdSize_BucketUnknown,
SUM(case when zip_ZIP_HouseholdSize < 0
and zip_ZIP_HouseholdSize <> -1 then 1
else 0
end) as zip_ZIP_HouseholdSize_BucketError,
SUM(case when zip_ZIP_HouseholdSize >= 0
AND zip_ZIP_HouseholdSize < 3 then 1
else 0
end) as zip_ZIP_HouseholdSize_Bucket0,
SUM(case when zip_ZIP_HouseholdSize >= 3 then 1
else 0
end) as zip_ZIP_HouseholdSize_Bucket1,
SUM(case when zip_ZIP_HousingHomeAppreciation IS null then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_BucketNullChars,
SUM(case when zip_ZIP_HousingHomeAppreciation = -1 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_BucketUnknown,
SUM(case when zip_ZIP_HousingHomeAppreciation < 0
and zip_ZIP_HousingHomeAppreciation <> -1 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_BucketError,
SUM(case when zip_ZIP_HousingHomeAppreciation >= 0
AND zip_ZIP_HousingHomeAppreciation < 1 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_Bucket0,
SUM(case when zip_ZIP_HousingHomeAppreciation >= 1
AND zip_ZIP_HousingHomeAppreciation < 3 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_Bucket1,
SUM(case when zip_ZIP_HousingHomeAppreciation >= 3
AND zip_ZIP_HousingHomeAppreciation < 5 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_Bucket2,
SUM(case when zip_ZIP_HousingHomeAppreciation >= 5
AND zip_ZIP_HousingHomeAppreciation < 8 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_Bucket3,
SUM(case when zip_ZIP_HousingHomeAppreciation >= 8 then 1
else 0
end) as zip_ZIP_HousingHomeAppreciation_Bucket4,
SUM(case when zip_ZIP_HousingHomeDepreciation IS null then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_BucketNullChars,
SUM(case when zip_ZIP_HousingHomeDepreciation = -1 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_BucketUnknown,
SUM(case when zip_ZIP_HousingHomeDepreciation < 0
and zip_ZIP_HousingHomeDepreciation <> -1 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_BucketError,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 0
AND zip_ZIP_HousingHomeDepreciation < 2 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket0,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 2
AND zip_ZIP_HousingHomeDepreciation < 3 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket1,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 3
AND zip_ZIP_HousingHomeDepreciation < 4 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket2,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 4
AND zip_ZIP_HousingHomeDepreciation < 6 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket3,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 6
AND zip_ZIP_HousingHomeDepreciation < 10 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket4,
SUM(case when zip_ZIP_HousingHomeDepreciation >= 10 then 1
else 0
end) as zip_ZIP_HousingHomeDepreciation_Bucket5,
SUM(case when zip_ZIP_HousingHomesOwned IS null then 1
else 0
end) as zip_ZIP_HousingHomesOwned_BucketNullChars,
SUM(case when zip_ZIP_HousingHomesOwned = -1 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_BucketUnknown,
SUM(case when zip_ZIP_HousingHomesOwned < 0
and zip_ZIP_HousingHomesOwned <> -1 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_BucketError,
SUM(case when zip_ZIP_HousingHomesOwned >= 0
AND zip_ZIP_HousingHomesOwned < 63 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket0,
SUM(case when zip_ZIP_HousingHomesOwned >= 63
AND zip_ZIP_HousingHomesOwned < 67 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket1,
SUM(case when zip_ZIP_HousingHomesOwned >= 67
AND zip_ZIP_HousingHomesOwned < 70 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket2,
SUM(case when zip_ZIP_HousingHomesOwned >= 70
AND zip_ZIP_HousingHomesOwned < 72 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket3,
SUM(case when zip_ZIP_HousingHomesOwned >= 72
AND zip_ZIP_HousingHomesOwned < 74 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket4,
SUM(case when zip_ZIP_HousingHomesOwned >= 74
AND zip_ZIP_HousingHomesOwned < 79 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket5,
SUM(case when zip_ZIP_HousingHomesOwned >= 79 then 1
else 0
end) as zip_ZIP_HousingHomesOwned_Bucket6,
SUM(case when zip_ZIP_HousingHomesRented IS null then 1
else 0
end) as zip_ZIP_HousingHomesRented_BucketNullChars,
SUM(case when zip_ZIP_HousingHomesRented = -1 then 1
else 0
end) as zip_ZIP_HousingHomesRented_BucketUnknown,
SUM(case when zip_ZIP_HousingHomesRented < 0
and zip_ZIP_HousingHomesRented <> -1 then 1
else 0
end) as zip_ZIP_HousingHomesRented_BucketError,
SUM(case when zip_ZIP_HousingHomesRented >= 0
AND zip_ZIP_HousingHomesRented < 14 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket0,
SUM(case when zip_ZIP_HousingHomesRented >= 14
AND zip_ZIP_HousingHomesRented < 17 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket1,
SUM(case when zip_ZIP_HousingHomesRented >= 17
AND zip_ZIP_HousingHomesRented < 21 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket2,
SUM(case when zip_ZIP_HousingHomesRented >= 21
AND zip_ZIP_HousingHomesRented < 24 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket3,
SUM(case when zip_ZIP_HousingHomesRented >= 24
AND zip_ZIP_HousingHomesRented < 30 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket4,
SUM(case when zip_ZIP_HousingHomesRented >= 30 then 1
else 0
end) as zip_ZIP_HousingHomesRented_Bucket5,
SUM(case when zip_ZIP_HousingMedianHomeAge IS null then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_BucketNullChars,
SUM(case when zip_ZIP_HousingMedianHomeAge = -1 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_BucketUnknown,
SUM(case when zip_ZIP_HousingMedianHomeAge < 0
and zip_ZIP_HousingMedianHomeAge <> -1 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_BucketError,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 0
AND zip_ZIP_HousingMedianHomeAge < 26 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket0,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 26
AND zip_ZIP_HousingMedianHomeAge < 30 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket1,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 30
AND zip_ZIP_HousingMedianHomeAge < 33 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket2,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 33
AND zip_ZIP_HousingMedianHomeAge < 36 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket3,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 36
AND zip_ZIP_HousingMedianHomeAge < 42 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket4,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 42
AND zip_ZIP_HousingMedianHomeAge < 49 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket5,
SUM(case when zip_ZIP_HousingMedianHomeAge >= 49 then 1
else 0
end) as zip_ZIP_HousingMedianHomeAge_Bucket6,
SUM(case when zip_ZIP_ReligionBaptist IS null then 1
else 0
end) as zip_ZIP_ReligionBaptist_BucketNullChars,
SUM(case when zip_ZIP_ReligionBaptist = -1 then 1
else 0
end) as zip_ZIP_ReligionBaptist_BucketUnknown,
SUM(case when zip_ZIP_ReligionBaptist < 0
and zip_ZIP_ReligionBaptist <> -1 then 1
else 0
end) as zip_ZIP_ReligionBaptist_BucketError,
SUM(case when zip_ZIP_ReligionBaptist >= 0
AND zip_ZIP_ReligionBaptist < 3 then 1
else 0
end) as zip_ZIP_ReligionBaptist_Bucket0,
SUM(case when zip_ZIP_ReligionBaptist >= 3
AND zip_ZIP_ReligionBaptist < 5 then 1
else 0
end) as zip_ZIP_ReligionBaptist_Bucket1,
SUM(case when zip_ZIP_ReligionBaptist >= 5
AND zip_ZIP_ReligionBaptist < 8 then 1
else 0
end) as zip_ZIP_ReligionBaptist_Bucket2,
SUM(case when zip_ZIP_ReligionBaptist >= 8
AND zip_ZIP_ReligionBaptist < 10 then 1
else 0
end) as zip_ZIP_ReligionBaptist_Bucket3,
SUM(case when zip_ZIP_ReligionBaptist >= 10 then 1
else 0
end) as zip_ZIP_ReligionBaptist_Bucket4,
SUM(case when zip_ZIP_ReligionCatholic IS null then 1
else 0
end) as zip_ZIP_ReligionCatholic_BucketNullChars,
SUM(case when zip_ZIP_ReligionCatholic = -1 then 1
else 0
end) as zip_ZIP_ReligionCatholic_BucketUnknown,
SUM(case when zip_ZIP_ReligionCatholic < 0
and zip_ZIP_ReligionCatholic <> -1 then 1
else 0
end) as zip_ZIP_ReligionCatholic_BucketError,
SUM(case when zip_ZIP_ReligionCatholic >= 0
AND zip_ZIP_ReligionCatholic < 5 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket0,
SUM(case when zip_ZIP_ReligionCatholic >= 5
AND zip_ZIP_ReligionCatholic < 8 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket1,
SUM(case when zip_ZIP_ReligionCatholic >= 8
AND zip_ZIP_ReligionCatholic < 12 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket2,
SUM(case when zip_ZIP_ReligionCatholic >= 12
AND zip_ZIP_ReligionCatholic < 14 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket3,
SUM(case when zip_ZIP_ReligionCatholic >= 14
AND zip_ZIP_ReligionCatholic < 22 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket4,
SUM(case when zip_ZIP_ReligionCatholic >= 22 then 1
else 0
end) as zip_ZIP_ReligionCatholic_Bucket5,
SUM(case when zip_ZIP_ReligionEpiscopalian IS null then 1
else 0
end) as zip_ZIP_ReligionEpiscopalian_BucketNullChars,
SUM(case when zip_ZIP_ReligionEpiscopalian = -1 then 1
else 0
end) as zip_ZIP_ReligionEpiscopalian_BucketUnknown,
SUM(case when zip_ZIP_ReligionEpiscopalian < 0
and zip_ZIP_ReligionEpiscopalian <> -1 then 1
else 0
end) as zip_ZIP_ReligionEpiscopalian_BucketError,
SUM(case when zip_ZIP_ReligionEpiscopalian >= 0
AND zip_ZIP_ReligionEpiscopalian < 1 then 1
else 0
end) as zip_ZIP_ReligionEpiscopalian_Bucket0,
SUM(case when zip_ZIP_ReligionEpiscopalian >= 1 then 1
else 0
end) as zip_ZIP_ReligionEpiscopalian_Bucket1,
SUM(case when zip_ZIP_ReligionLDS IS null then 1
else 0
end) as zip_ZIP_ReligionLDS_BucketNullChars,
SUM(case when zip_ZIP_ReligionLDS = -1 then 1
else 0
end) as zip_ZIP_ReligionLDS_BucketUnknown,
SUM(case when zip_ZIP_ReligionLDS < 0
and zip_ZIP_ReligionLDS <> -1 then 1
else 0
end) as zip_ZIP_ReligionLDS_BucketError,
SUM(case when zip_ZIP_ReligionLDS >= 0
AND zip_ZIP_ReligionLDS < 1 then 1
else 0
end) as zip_ZIP_ReligionLDS_Bucket0,
SUM(case when zip_ZIP_ReligionLDS >= 1 then 1
else 0
end) as zip_ZIP_ReligionLDS_Bucket1,
SUM(case when zip_ZIP_ReligionLutheran IS null then 1
else 0
end) as zip_ZIP_ReligionLutheran_BucketNullChars,
SUM(case when zip_ZIP_ReligionLutheran = -1 then 1
else 0
end) as zip_ZIP_ReligionLutheran_BucketUnknown,
SUM(case when zip_ZIP_ReligionLutheran < 0
and zip_ZIP_ReligionLutheran <> -1 then 1
else 0
end) as zip_ZIP_ReligionLutheran_BucketError,
SUM(case when zip_ZIP_ReligionLutheran >= 0
AND zip_ZIP_ReligionLutheran < 1 then 1
else 0
end) as zip_ZIP_ReligionLutheran_Bucket0,
SUM(case when zip_ZIP_ReligionLutheran >= 1
AND zip_ZIP_ReligionLutheran < 2 then 1
else 0
end) as zip_ZIP_ReligionLutheran_Bucket1,
SUM(case when zip_ZIP_ReligionLutheran >= 2
AND zip_ZIP_ReligionLutheran < 3 then 1
else 0
end) as zip_ZIP_ReligionLutheran_Bucket2,
SUM(case when zip_ZIP_ReligionLutheran >= 3
AND zip_ZIP_ReligionLutheran < 5 then 1
else 0
end) as zip_ZIP_ReligionLutheran_Bucket3,
SUM(case when zip_ZIP_ReligionLutheran >= 5 then 1
else 0
end) as zip_ZIP_ReligionLutheran_Bucket4,
SUM(case when zip_ZIP_ReligionMethodist IS null then 1
else 0
end) as zip_ZIP_ReligionMethodist_BucketNullChars,
SUM(case when zip_ZIP_ReligionMethodist = -1 then 1
else 0
end) as zip_ZIP_ReligionMethodist_BucketUnknown,
SUM(case when zip_ZIP_ReligionMethodist < 0
and zip_ZIP_ReligionMethodist <> -1 then 1
else 0
end) as zip_ZIP_ReligionMethodist_BucketError,
SUM(case when zip_ZIP_ReligionMethodist >= 0
AND zip_ZIP_ReligionMethodist < 4 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket0,
SUM(case when zip_ZIP_ReligionMethodist >= 4
AND zip_ZIP_ReligionMethodist < 5 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket1,
SUM(case when zip_ZIP_ReligionMethodist >= 5
AND zip_ZIP_ReligionMethodist < 6 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket2,
SUM(case when zip_ZIP_ReligionMethodist >= 6
AND zip_ZIP_ReligionMethodist < 7 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket3,
SUM(case when zip_ZIP_ReligionMethodist >= 7
AND zip_ZIP_ReligionMethodist < 8 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket4,
SUM(case when zip_ZIP_ReligionMethodist >= 8
AND zip_ZIP_ReligionMethodist < 10 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket5,
SUM(case when zip_ZIP_ReligionMethodist >= 10 then 1
else 0
end) as zip_ZIP_ReligionMethodist_Bucket6,
SUM(case when zip_ZIP_ReligionOtherChristian IS null then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_BucketNullChars,
SUM(case when zip_ZIP_ReligionOtherChristian = -1 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_BucketUnknown,
SUM(case when zip_ZIP_ReligionOtherChristian < 0
and zip_ZIP_ReligionOtherChristian <> -1 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_BucketError,
SUM(case when zip_ZIP_ReligionOtherChristian >= 0
AND zip_ZIP_ReligionOtherChristian < 7 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket0,
SUM(case when zip_ZIP_ReligionOtherChristian >= 7
AND zip_ZIP_ReligionOtherChristian < 8 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket1,
SUM(case when zip_ZIP_ReligionOtherChristian >= 8
AND zip_ZIP_ReligionOtherChristian < 10 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket2,
SUM(case when zip_ZIP_ReligionOtherChristian >= 10
AND zip_ZIP_ReligionOtherChristian < 12 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket3,
SUM(case when zip_ZIP_ReligionOtherChristian >= 12
AND zip_ZIP_ReligionOtherChristian < 14 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket4,
SUM(case when zip_ZIP_ReligionOtherChristian >= 14
AND zip_ZIP_ReligionOtherChristian < 19 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket5,
SUM(case when zip_ZIP_ReligionOtherChristian >= 19 then 1
else 0
end) as zip_ZIP_ReligionOtherChristian_Bucket6,
SUM(case when zip_ZIP_ReligionPentecostal IS null then 1
else 0
end) as zip_ZIP_ReligionPentecostal_BucketNullChars,
SUM(case when zip_ZIP_ReligionPentecostal = -1 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_BucketUnknown,
SUM(case when zip_ZIP_ReligionPentecostal < 0
and zip_ZIP_ReligionPentecostal <> -1 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_BucketError,
SUM(case when zip_ZIP_ReligionPentecostal >= 0
AND zip_ZIP_ReligionPentecostal < 1 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_Bucket0,
SUM(case when zip_ZIP_ReligionPentecostal >= 1
AND zip_ZIP_ReligionPentecostal < 2 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_Bucket1,
SUM(case when zip_ZIP_ReligionPentecostal >= 2
AND zip_ZIP_ReligionPentecostal < 3 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_Bucket2,
SUM(case when zip_ZIP_ReligionPentecostal >= 3 then 1
else 0
end) as zip_ZIP_ReligionPentecostal_Bucket3,
SUM(case when zip_ZIP_ReligionPercentReligious IS null then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_BucketNullChars,
SUM(case when zip_ZIP_ReligionPercentReligious = -1 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_BucketUnknown,
SUM(case when zip_ZIP_ReligionPercentReligious < 0
and zip_ZIP_ReligionPercentReligious <> -1 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_BucketError,
SUM(case when zip_ZIP_ReligionPercentReligious >= 0
AND zip_ZIP_ReligionPercentReligious < 36 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket0,
SUM(case when zip_ZIP_ReligionPercentReligious >= 36
AND zip_ZIP_ReligionPercentReligious < 39 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket1,
SUM(case when zip_ZIP_ReligionPercentReligious >= 39
AND zip_ZIP_ReligionPercentReligious < 41 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket2,
SUM(case when zip_ZIP_ReligionPercentReligious >= 41
AND zip_ZIP_ReligionPercentReligious < 43 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket3,
SUM(case when zip_ZIP_ReligionPercentReligious >= 43
AND zip_ZIP_ReligionPercentReligious < 45 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket4,
SUM(case when zip_ZIP_ReligionPercentReligious >= 45
AND zip_ZIP_ReligionPercentReligious < 48 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket5,
SUM(case when zip_ZIP_ReligionPercentReligious >= 48
AND zip_ZIP_ReligionPercentReligious < 53 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket6,
SUM(case when zip_ZIP_ReligionPercentReligious >= 53 then 1
else 0
end) as zip_ZIP_ReligionPercentReligious_Bucket7,
SUM(case when zip_ZIP_ReligionPresbyterian IS null then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_BucketNullChars,
SUM(case when zip_ZIP_ReligionPresbyterian = -1 then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_BucketUnknown,
SUM(case when zip_ZIP_ReligionPresbyterian < 0
and zip_ZIP_ReligionPresbyterian <> -1 then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_BucketError,
SUM(case when zip_ZIP_ReligionPresbyterian >= 0
AND zip_ZIP_ReligionPresbyterian < 1 then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_Bucket0,
SUM(case when zip_ZIP_ReligionPresbyterian >= 1
AND zip_ZIP_ReligionPresbyterian < 2 then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_Bucket1,
SUM(case when zip_ZIP_ReligionPresbyterian >= 2 then 1
else 0
end) as zip_ZIP_ReligionPresbyterian_Bucket2,
SUM(case when zip_ZIP_ReligionProtestant IS null then 1
else 0
end) as zip_ZIP_ReligionProtestant_BucketNullChars,
SUM(case when zip_ZIP_ReligionProtestant = -1 then 1
else 0
end) as zip_ZIP_ReligionProtestant_BucketUnknown,
SUM(case when zip_ZIP_ReligionProtestant < 0
and zip_ZIP_ReligionProtestant <> -1 then 1
else 0
end) as zip_ZIP_ReligionProtestant_BucketError,
SUM(case when zip_ZIP_ReligionProtestant >= 0
AND zip_ZIP_ReligionProtestant < 14 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket0,
SUM(case when zip_ZIP_ReligionProtestant >= 14
AND zip_ZIP_ReligionProtestant < 16 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket1,
SUM(case when zip_ZIP_ReligionProtestant >= 16
AND zip_ZIP_ReligionProtestant < 19 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket2,
SUM(case when zip_ZIP_ReligionProtestant >= 19
AND zip_ZIP_ReligionProtestant < 22 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket3,
SUM(case when zip_ZIP_ReligionProtestant >= 22
AND zip_ZIP_ReligionProtestant < 28 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket4,
SUM(case when zip_ZIP_ReligionProtestant >= 28 then 1
else 0
end) as zip_ZIP_ReligionProtestant_Bucket5,
SUM(case when zip_ZIP_SinglePopulation IS null then 1
else 0
end) as zip_ZIP_SinglePopulation_BucketNullChars,
SUM(case when zip_ZIP_SinglePopulation = -1 then 1
else 0
end) as zip_ZIP_SinglePopulation_BucketUnknown,
SUM(case when zip_ZIP_SinglePopulation < 0
and zip_ZIP_SinglePopulation <> -1 then 1
else 0
end) as zip_ZIP_SinglePopulation_BucketError,
SUM(case when zip_ZIP_SinglePopulation >= 0
AND zip_ZIP_SinglePopulation < 34 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket0,
SUM(case when zip_ZIP_SinglePopulation >= 34
AND zip_ZIP_SinglePopulation < 37 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket1,
SUM(case when zip_ZIP_SinglePopulation >= 37
AND zip_ZIP_SinglePopulation < 39 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket2,
SUM(case when zip_ZIP_SinglePopulation >= 39
AND zip_ZIP_SinglePopulation < 42 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket3,
SUM(case when zip_ZIP_SinglePopulation >= 42
AND zip_ZIP_SinglePopulation < 46 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket4,
SUM(case when zip_ZIP_SinglePopulation >= 46 then 1
else 0
end) as zip_ZIP_SinglePopulation_Bucket5,
SUM(case when zip_ZIP_SingleWithChildren IS null then 1
else 0
end) as zip_ZIP_SingleWithChildren_BucketNullChars,
SUM(case when zip_ZIP_SingleWithChildren = -1 then 1
else 0
end) as zip_ZIP_SingleWithChildren_BucketUnknown,
SUM(case when zip_ZIP_SingleWithChildren < 0
and zip_ZIP_SingleWithChildren <> -1 then 1
else 0
end) as zip_ZIP_SingleWithChildren_BucketError,
SUM(case when zip_ZIP_SingleWithChildren >= 0
AND zip_ZIP_SingleWithChildren < 7 then 1
else 0
end) as zip_ZIP_SingleWithChildren_Bucket0,
SUM(case when zip_ZIP_SingleWithChildren >= 7
AND zip_ZIP_SingleWithChildren < 8 then 1
else 0
end) as zip_ZIP_SingleWithChildren_Bucket1,
SUM(case when zip_ZIP_SingleWithChildren >= 8
AND zip_ZIP_SingleWithChildren < 9 then 1
else 0
end) as zip_ZIP_SingleWithChildren_Bucket2,
SUM(case when zip_ZIP_SingleWithChildren >= 9
AND zip_ZIP_SingleWithChildren < 10 then 1
else 0
end) as zip_ZIP_SingleWithChildren_Bucket3,
SUM(case when zip_ZIP_SingleWithChildren >= 10 then 1
else 0
end) as zip_ZIP_SingleWithChildren_Bucket4,
SUM(case when zip_ZIP_TransportationAutoAlone IS null then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_BucketNullChars,
SUM(case when zip_ZIP_TransportationAutoAlone = -1 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_BucketUnknown,
SUM(case when zip_ZIP_TransportationAutoAlone < 0
and zip_ZIP_TransportationAutoAlone <> -1 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_BucketError,
SUM(case when zip_ZIP_TransportationAutoAlone >= 0
AND zip_ZIP_TransportationAutoAlone < 78 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket0,
SUM(case when zip_ZIP_TransportationAutoAlone >= 78
AND zip_ZIP_TransportationAutoAlone < 80 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket1,
SUM(case when zip_ZIP_TransportationAutoAlone >= 80
AND zip_ZIP_TransportationAutoAlone < 82 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket2,
SUM(case when zip_ZIP_TransportationAutoAlone >= 82
AND zip_ZIP_TransportationAutoAlone < 84 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket3,
SUM(case when zip_ZIP_TransportationAutoAlone >= 84
AND zip_ZIP_TransportationAutoAlone < 86 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket4,
SUM(case when zip_ZIP_TransportationAutoAlone >= 86
AND zip_ZIP_TransportationAutoAlone < 88 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket5,
SUM(case when zip_ZIP_TransportationAutoAlone >= 88 then 1
else 0
end) as zip_ZIP_TransportationAutoAlone_Bucket6,
SUM(case when zip_ZIP_TransportationCarpool IS null then 1
else 0
end) as zip_ZIP_TransportationCarpool_BucketNullChars,
SUM(case when zip_ZIP_TransportationCarpool = -1 then 1
else 0
end) as zip_ZIP_TransportationCarpool_BucketUnknown,
SUM(case when zip_ZIP_TransportationCarpool < 0
and zip_ZIP_TransportationCarpool <> -1 then 1
else 0
end) as zip_ZIP_TransportationCarpool_BucketError,
SUM(case when zip_ZIP_TransportationCarpool >= 0
AND zip_ZIP_TransportationCarpool < 8 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket0,
SUM(case when zip_ZIP_TransportationCarpool >= 8
AND zip_ZIP_TransportationCarpool < 9 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket1,
SUM(case when zip_ZIP_TransportationCarpool >= 9
AND zip_ZIP_TransportationCarpool < 10 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket2,
SUM(case when zip_ZIP_TransportationCarpool >= 10
AND zip_ZIP_TransportationCarpool < 11 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket3,
SUM(case when zip_ZIP_TransportationCarpool >= 11
AND zip_ZIP_TransportationCarpool < 12 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket4,
SUM(case when zip_ZIP_TransportationCarpool >= 12
AND zip_ZIP_TransportationCarpool < 15 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket5,
SUM(case when zip_ZIP_TransportationCarpool >= 15 then 1
else 0
end) as zip_ZIP_TransportationCarpool_Bucket6,
SUM(case when zip_ZIP_TransportationCommuteTime IS null then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteTime = -1 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteTime < 0
and zip_ZIP_TransportationCommuteTime <> -1 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_BucketError,
SUM(case when zip_ZIP_TransportationCommuteTime >= 0
AND zip_ZIP_TransportationCommuteTime < 22 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteTime >= 22
AND zip_ZIP_TransportationCommuteTime < 24 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteTime >= 24
AND zip_ZIP_TransportationCommuteTime < 26 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteTime >= 26
AND zip_ZIP_TransportationCommuteTime < 28 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteTime >= 28
AND zip_ZIP_TransportationCommuteTime < 31 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteTime >= 31 then 1
else 0
end) as zip_ZIP_TransportationCommuteTime_Bucket5,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min IS null
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min = -1 then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min < 0
and zip_ZIP_TransportationCommuteToWork15To29min <> -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_BucketError,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 0
AND zip_ZIP_TransportationCommuteToWork15To29min < 25
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 25
AND zip_ZIP_TransportationCommuteToWork15To29min < 28
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 28
AND zip_ZIP_TransportationCommuteToWork15To29min < 32
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 32
AND zip_ZIP_TransportationCommuteToWork15To29min < 36
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 36
AND zip_ZIP_TransportationCommuteToWork15To29min < 40
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 40
AND zip_ZIP_TransportationCommuteToWork15To29min < 44
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket5,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 44
AND zip_ZIP_TransportationCommuteToWork15To29min < 49
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket6,
SUM(case when zip_ZIP_TransportationCommuteToWork15To29min >= 49
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork15To29min_Bucket7,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min IS null
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min = -1 then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min < 0
and zip_ZIP_TransportationCommuteToWork30To44min <> -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_BucketError,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 0
AND zip_ZIP_TransportationCommuteToWork30To44min < 12
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 12
AND zip_ZIP_TransportationCommuteToWork30To44min < 14
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 14
AND zip_ZIP_TransportationCommuteToWork30To44min < 17
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 17
AND zip_ZIP_TransportationCommuteToWork30To44min < 21
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 21
AND zip_ZIP_TransportationCommuteToWork30To44min < 27
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteToWork30To44min >= 27
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork30To44min_Bucket5,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min IS null
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min = -1 then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min < 0
and zip_ZIP_TransportationCommuteToWork45To59min <> -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_BucketError,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 0
AND zip_ZIP_TransportationCommuteToWork45To59min < 3
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 3
AND zip_ZIP_TransportationCommuteToWork45To59min < 4
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 4
AND zip_ZIP_TransportationCommuteToWork45To59min < 5
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 5
AND zip_ZIP_TransportationCommuteToWork45To59min < 7
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 7
AND zip_ZIP_TransportationCommuteToWork45To59min < 9
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 9
AND zip_ZIP_TransportationCommuteToWork45To59min < 13
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket5,
SUM(case when zip_ZIP_TransportationCommuteToWork45To59min >= 13
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWork45To59min_Bucket6,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min IS null
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min = -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 0
and zip_ZIP_TransportationCommuteToWorkGreaterThan60min <> -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_BucketError,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 0
AND zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 4
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 4
AND zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 5
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 5
AND zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 6
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 6
AND zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 8
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 8
AND zip_ZIP_TransportationCommuteToWorkGreaterThan60min < 11
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteToWorkGreaterThan60min >= 11
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkGreaterThan60min_Bucket5,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min IS null
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_BucketNullChars,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min = -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_BucketUnknown,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min < 0
and zip_ZIP_TransportationCommuteToWorkLessThan15min <> -1
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_BucketError,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 0
AND zip_ZIP_TransportationCommuteToWorkLessThan15min < 19
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket0,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 19
AND zip_ZIP_TransportationCommuteToWorkLessThan15min < 27
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket1,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 27
AND zip_ZIP_TransportationCommuteToWorkLessThan15min < 31
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket2,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 31
AND zip_ZIP_TransportationCommuteToWorkLessThan15min < 39
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket3,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 39
AND zip_ZIP_TransportationCommuteToWorkLessThan15min < 45
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket4,
SUM(case when zip_ZIP_TransportationCommuteToWorkLessThan15min >= 45
then 1
else 0
end) as zip_ZIP_TransportationCommuteToWorkLessThan15min_Bucket5,
SUM(case when zip_ZIP_TransportationMassTransit IS null then 1
else 0
end) as zip_ZIP_TransportationMassTransit_BucketNullChars,
SUM(case when zip_ZIP_TransportationMassTransit = -1 then 1
else 0
end) as zip_ZIP_TransportationMassTransit_BucketUnknown,
SUM(case when zip_ZIP_TransportationMassTransit < 0
and zip_ZIP_TransportationMassTransit <> -1 then 1
else 0
end) as zip_ZIP_TransportationMassTransit_BucketError,
SUM(case when zip_ZIP_TransportationMassTransit >= 0
AND zip_ZIP_TransportationMassTransit < 1 then 1
else 0
end) as zip_ZIP_TransportationMassTransit_Bucket0,
SUM(case when zip_ZIP_TransportationMassTransit >= 1 then 1
else 0
end) as zip_ZIP_TransportationMassTransit_Bucket1,
SUM(case when zip_ZIP_TransportationWorkAtHome IS null then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_BucketNullChars,
SUM(case when zip_ZIP_TransportationWorkAtHome = -1 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_BucketUnknown,
SUM(case when zip_ZIP_TransportationWorkAtHome < 0
and zip_ZIP_TransportationWorkAtHome <> -1 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_BucketError,
SUM(case when zip_ZIP_TransportationWorkAtHome >= 0
AND zip_ZIP_TransportationWorkAtHome < 3 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_Bucket0,
SUM(case when zip_ZIP_TransportationWorkAtHome >= 3
AND zip_ZIP_TransportationWorkAtHome < 4 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_Bucket1,
SUM(case when zip_ZIP_TransportationWorkAtHome >= 4
AND zip_ZIP_TransportationWorkAtHome < 5 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_Bucket2,
SUM(case when zip_ZIP_TransportationWorkAtHome >= 5 then 1
else 0
end) as zip_ZIP_TransportationWorkAtHome_Bucket3,
SUM(case when zip_ZIP_ViolentCrime IS null then 1
else 0
end) as zip_ZIP_ViolentCrime_BucketNullChars,
SUM(case when zip_ZIP_ViolentCrime = -1 then 1
else 0
end) as zip_ZIP_ViolentCrime_BucketUnknown,
SUM(case when zip_ZIP_ViolentCrime < 0
and zip_ZIP_ViolentCrime <> -1 then 1
else 0
end) as zip_ZIP_ViolentCrime_BucketError,
SUM(case when zip_ZIP_ViolentCrime >= 0
AND zip_ZIP_ViolentCrime < 2 then 1
else 0
end) as zip_ZIP_ViolentCrime_Bucket0,
SUM(case when zip_ZIP_ViolentCrime >= 2
AND zip_ZIP_ViolentCrime < 3 then 1
else 0
end) as zip_ZIP_ViolentCrime_Bucket1,
SUM(case when zip_ZIP_ViolentCrime >= 3
AND zip_ZIP_ViolentCrime < 4 then 1
else 0
end) as zip_ZIP_ViolentCrime_Bucket2,
SUM(case when zip_ZIP_ViolentCrime >= 4
AND zip_ZIP_ViolentCrime < 6 then 1
else 0
end) as zip_ZIP_ViolentCrime_Bucket3,
SUM(case when zip_ZIP_ViolentCrime >= 6 then 1
else 0
end) as zip_ZIP_ViolentCrime_Bucket4,
SUM(case when zip_ZIP_VotingDemocrat IS null then 1
else 0
end) as zip_ZIP_VotingDemocrat_BucketNullChars,
SUM(case when zip_ZIP_VotingDemocrat = -1 then 1
else 0
end) as zip_ZIP_VotingDemocrat_BucketUnknown,
SUM(case when zip_ZIP_VotingDemocrat < 0
and zip_ZIP_VotingDemocrat <> -1 then 1
else 0
end) as zip_ZIP_VotingDemocrat_BucketError,
SUM(case when zip_ZIP_VotingDemocrat >= 0
AND zip_ZIP_VotingDemocrat < 27 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket0,
SUM(case when zip_ZIP_VotingDemocrat >= 27
AND zip_ZIP_VotingDemocrat < 31 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket1,
SUM(case when zip_ZIP_VotingDemocrat >= 31
AND zip_ZIP_VotingDemocrat < 34 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket2,
SUM(case when zip_ZIP_VotingDemocrat >= 34
AND zip_ZIP_VotingDemocrat < 37 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket3,
SUM(case when zip_ZIP_VotingDemocrat >= 37
AND zip_ZIP_VotingDemocrat < 42 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket4,
SUM(case when zip_ZIP_VotingDemocrat >= 42
AND zip_ZIP_VotingDemocrat < 49 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket5,
SUM(case when zip_ZIP_VotingDemocrat >= 49 then 1
else 0
end) as zip_ZIP_VotingDemocrat_Bucket6,
SUM(case when zip_ZIP_VotingRepublican IS null then 1
else 0
end) as zip_ZIP_VotingRepublican_BucketNullChars,
SUM(case when zip_ZIP_VotingRepublican = -1 then 1
else 0
end) as zip_ZIP_VotingRepublican_BucketUnknown,
SUM(case when zip_ZIP_VotingRepublican < 0
and zip_ZIP_VotingRepublican <> -1 then 1
else 0
end) as zip_ZIP_VotingRepublican_BucketError,
SUM(case when zip_ZIP_VotingRepublican >= 0
AND zip_ZIP_VotingRepublican < 51 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket0,
SUM(case when zip_ZIP_VotingRepublican >= 51
AND zip_ZIP_VotingRepublican < 59 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket1,
SUM(case when zip_ZIP_VotingRepublican >= 59
AND zip_ZIP_VotingRepublican < 63 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket2,
SUM(case when zip_ZIP_VotingRepublican >= 63
AND zip_ZIP_VotingRepublican < 67 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket3,
SUM(case when zip_ZIP_VotingRepublican >= 67
AND zip_ZIP_VotingRepublican < 69 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket4,
SUM(case when zip_ZIP_VotingRepublican >= 69
AND zip_ZIP_VotingRepublican < 73 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket5,
SUM(case when zip_ZIP_VotingRepublican >= 73 then 1
else 0
end) as zip_ZIP_VotingRepublican_Bucket6
FROM tbl_Prepped_Vehicle_ver01_20100823
WHERE ( group_id > 0 )
π
August 30, 2010 at 7:36 am
:w00t::w00t::w00t::w00t::w00t::w00t:
Yes chock that one as one of the worst ever!!! Maintain??? I would rather take out my eyeballs to pop them!!!
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 30, 2010 at 7:48 am
From a quick scan it's not that bad... It's obviously some sort of pivot table with a single table scan.
The real question is why they need so many columns but I can see that happenning if you have a complex report with graphics involved.
Definitely long, but not the worst out there.
August 30, 2010 at 7:56 am
Agreed that this looks like a query for a report but the column names make me cringe [zip_ZIP_TransportationCommuteToWork15To29min]. Thankfully this is 2008 so there is some intellisense. This would be extremely painful without it. And of course it could be cut down in length very easily by putting each field on a single line, that would reduce the length by nearly 75%.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 30, 2010 at 8:06 am
That does look like the result of a lost argument between a dba and a business user π
MCITP SQL Server 2005/2008 DBA/DBD
August 30, 2010 at 8:09 am
Lots of columns, one table... eh.
Try messing with an 86 table join. That's when life gets interesting.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 30, 2010 at 8:39 am
I wouldnt say it qualifies as worst ever. Its long, but its also one table with few conditions and its easy to figure out what its doing. The table and field naming leaves something to be desired, to be sure, and if the resultset wouldnt be too massive you could argue that the fields should just be queried and the client should do the summarizing, but assuming there isnt a better index to be used the query is probably as good as its gonna get.
August 30, 2010 at 8:44 am
Thanks for the replies and the sanity checks!
π
August 30, 2010 at 8:44 am
Grant Fritchey (8/30/2010)
Lots of columns, one table... eh.Try messing with an 86 table join. That's when life gets interesting.
especially if the columns are not qualified and that you don't have intellissence (from any cie) ;-).
August 30, 2010 at 8:47 am
Ninja's_RGR'us (8/30/2010)
Grant Fritchey (8/30/2010)
Lots of columns, one table... eh.Try messing with an 86 table join. That's when life gets interesting.
especially if the columns are not qualified and that you don't have intellissence (from any cie) ;-).
Oh yuck! That wouldn't be much fun.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 15 posts - 1 through 15 (of 22 total)
You must be logged in to reply to this topic. Login to reply