gpt4 book ai didi

php - 给定 MySQL 的返回数量,如何找到平均 AGI?

转载 作者:行者123 更新时间:2023-11-29 06:55:55 26 4
gpt4 key购买 nike

数据可从 IRS 免费获得 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 中做到这一点?谢谢!

最佳答案

select zipcode, 
avg(A00100) as average_income
from taxbyzip2008
group by zipcode

关于php - 给定 MySQL 的返回数量,如何找到平均 AGI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12710041/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com