这些数据可从美国国税局免费获得,按邮政编码计算 2008 年的收入数据。
A00100 是调整后的总收入(又名 AGI),agi_class 是调整后的总收入的大小。范围从 1 到 7:
1 = 'Under $10,000'
2 = '$10,000 under $25,000'
3 = '$25,000 under $50,000'
4 = '$50,000 under $75,000'
5 = '$75,000 under $100,000'
6 = '$100,000 under $200,000'
7 = '$200,000 or more '
“退货数量”是该 agi_class 的纳税申报数量。
mysql> select A00100,zipcode,agi_class,N1 as 'Number of Returns' from taxbyzip2008 where zipcode="10021";
+-------------+---------+-----------+-------------------+
| A00100 | zipcode | agi_class | Number of Returns |
+-------------+---------+-----------+-------------------+
| -954234 | 10021 | 1 | 3589 |
| 43243455 | 10021 | 2 | 2521 |
| 149940475 | 10021 | 3 | 3939 |
| 243853640 | 10021 | 4 | 3936 |
| 262995399 | 10021 | 5 | 3025 |
| 751195421 | 10021 | 6 | 5333 |
| 10677437299 | 10021 | 7 | 7477 |
+-------------+---------+-----------+-------------------+
我需要得出每个邮政编码的平均调整后总收入。我怎样才能在 MySQL 中做到这一点?谢谢!