编程要求
在右侧编辑器补充代码,查询出2013年7月22日的哪三种股票买入量最多。
表名:total
col_name data_type comment
tradedate string 交易日期
tradetime string 交易时间
securityid string 股票ID
bidpx1 string 买入价
bidsize1 int 买入量
offerpx1 string 卖出价
bidsize2 int 卖出量
部分数据:
20130724 145004 152896 2.62 6960 2.63 13000
20130724 145101 152896 2.86 13880 2.89 6270
20130724 145128 152896 2.85 327400 2.851 1500
20130724 145143 152896 2.603 44630 2.8 10650
数据说明:
(152896:每种股票id)
(20130724: 2013年7月24日)
(145004: 14点50分04秒)
测试说明
平台会对你编写的代码进行测试:
预期输出:
股票id 买入量
553211 680580680
412233 230929160
856947 104360800
select securityid,sum(bidsize1) as sumb from total where tradedate="20130722" group by securityid order by sumb desc limit 3;
特别强调:order by 后面不能加聚合函数,必须要在前面定义好函数,后面再用上。
聚合函数:
常见聚合函数,max(最大)、min(最小)、sum(求和)、avg(平均)等