设为首页 加入收藏

TOP

某公司数据库面试题
2014-11-24 03:02:37 来源: 作者: 【 】 浏览:4
Tags:公司 数据库 试题
某公司 数据库面试题
----------------------------------------------
In database XYZ, there's a table 'run_key' with the following rows:

id batch last_processed
------------------------------
1  5           999
2 6           999
3  7             0
4  5             0
5  6           999
6  7             0
7  5             0
8  6             0
9 7           999
10 7             0

Write a SQL statement to return the number of rows with last_processed=0 for each batch.
The expected output is:
batch count
-------------
5             2
6             1
7             3

answer:
[sql] 
select batch,count(batch) as count from run_key where last_processed=0 group by batch;  


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇启动HBase后遇到的一个问题 下一篇循序渐进PostgreSQL(三): 网络访..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·哈希表 - 菜鸟教程 (2025-12-24 20:18:55)
·MySQL存储引擎InnoDB (2025-12-24 20:18:53)
·索引堆及其优化 - 菜 (2025-12-24 20:18:50)
·Shell 中各种括号的 (2025-12-24 19:50:39)
·Shell 变量 - 菜鸟教 (2025-12-24 19:50:37)