题库 软件开发 题目列表 假设有一张账目表account,里面记录着你今年的每一笔开...
单选题
假设有一张账目表account,里面记录着你今年的每一笔开支,目前你想查看一下3月和7月这两个月份哪个月份的消费总额最高,那么下面正确的sql语句是
create table `account`(
    `id` int(11) not null auto_increment,
    `month` int(11) not null comment '月份',
    `item` char(50) not null comment '开支条目',
    `pay` int(11) not null comment '消费金额',
    primary key(`id`)
)engine = innodb;

A.

select month,count(pay) c from account where month between 3 and 7 group by month order by c desc limit 1

B.

select month,sum(pay) s from account where month = 3 and month = 7 group by month order by s desc limit 1

C.

select month,count(pay) c from account where month = 3 or month=7 group by month order by c desc limit 1

D.

select month,sum(pay) s from account where month in (3,7) group by month order by s desc limit 1

题目信息
校招真题
-
正确率
0
评论
19
点击