首页 > 试题广场 >

实习广场投递简历分析(一)

[编程题]实习广场投递简历分析(一)
  • 热度指数:67199 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
在牛客实习广场有很多公司开放职位给同学们投递,同学投递完就会把简历信息存到数据库里。
现在有简历信息表(resume_info),部分信息简况如下:
id job date num
1 C++ 2025-01-02 53
2 Python 2025-01-02
23
3 Java 2025-01-02
12
4 Java
2025-02-03
24
5 C++
2025-02-03
23
6 Python
2025-02-03
34
7 Python
2025-03-04
54
8 C++
2025-03-04
65
9 Java
2025-03-04
92
10 Java
2026-01-04
230
第1行表示,在2025年1月2号,C++岗位收到了53封简历
。。。
最后1行表示,在2026年1月4号,Java岗位收到了230封简历

请你写出SQL语句查询在2025年内投递简历的岗位和数量,并且按数量降序排序,以上例子查询结果如下:
job cnt
C++
141
Java
128
Python
111
示例1

输入

drop table if exists resume_info;
CREATE TABLE resume_info (
id int(4) NOT NULL,
job varchar(64) NOT NULL,
date date NOT NULL,
num int(11) NOT NULL,
PRIMARY KEY (id));

INSERT INTO resume_info VALUES
(1,'C++','2025-01-02',53),
(2,'Python','2025-01-02',23),
(3,'Java','2025-01-02',12),
(4,'Java','2025-02-03',24),
(5,'C++','2025-02-03',23),
(6,'Python','2025-02-03',34),
(7,'Python','2025-03-04',54),
(8,'C++','2025-03-04',65),
(9,'Java','2025-03-04',92),
(10,'Java','2026-01-04',230);

输出

C++|141
Java|128
Python|111
select
    job,
    sum(num) cnt
from
    resume_info
where
    date between '2025-01-01' and '2025-12-31'
group by job
order by cnt desc;

发表于 2025-01-09 16:45:50 回复(0)
select job,sum(num) as cnt
from resume_info
where year(date)='2025'
group by job
order by sum(num) desc
发表于 2024-10-25 18:15:24 回复(0)

where + group by + order by
简单查询用法

select job, sum(num) as cnt
from resume_info
where 
date >= '2025-01-01' and date < '2026-01-01'
group by job
order by sum(num) desc
发表于 2024-08-14 17:05:11 回复(0)
SELECT DISTINCT  r.job,  SUM(r.num)OVER ( PARTITION BY r.job  ) cnt FROM  ( SELECT  *  FROM  resume_info WHERE  YEAR (date) = '2025'  ) r ORDER BY  cnt DESC

我想用这种方法练习一下聚合窗口函数,在这里提交是对的,但在datagrip上,得到的答案没有分组求和,是把三种语言都加和到一起了。有人可以帮忙解答一下吗

发表于 2024-08-01 11:01:03 回复(0)
select job,sum(num) as cnt
from resume_info
where date >= '2025-01-01' and date <= '2025-12-31'
group by job
order by cnt desc;

发表于 2024-04-12 09:22:12 回复(0)
select job ,
sum(num) as cnt
from
(select *
from resume_info
where date between '2025-01-01' and '2025-12-31') t1
group by job
order by cnt desc
发表于 2024-03-04 21:52:21 回复(0)
select job,sum(num) cnt from resume_info
where date like '2025-%'
group by job
order by cnt desc;

编辑于 2024-02-05 14:10:55 回复(0)
select job, sum(num) as cnt
from resume_info
where year(date) = '2025'
group by job
order by sum(num) desc;
编辑于 2024-01-22 21:45:53 回复(0)
select 
    job,
    sum(num) as cnt
from resume_info
where date between '2025-01-01' and '2025-12-31'
group by job
order by sum(num) desc


so easy
发表于 2023-11-26 20:20:29 回复(0)
select job,sum(num) cnt
from resume_info
where year(date)=2025
group by job
order by cnt desc

发表于 2023-06-11 15:13:37 回复(0)
easy peesy
select
    job
    ,sum(num) as cnt
from 
    resume_info
where
    year(date) = 2025
group by
    job
order by 
    cnt desc

发表于 2023-05-26 15:15:33 回复(0)
select job, sum(num) cnt
from resume_info
where year(date) = 2025
group by job
order by cnt desc;

发表于 2022-12-30 23:36:57 回复(0)
select job,sum(num) as cnt
from resume_info
where year(date)<2026
group by job
order by cnt desc;
发表于 2022-10-14 23:41:21 回复(0)
select distinct job,sum(num)over(partition by job) sumnum from resume_info
where YEAR(date)=2025
order by sumnum desc

发表于 2022-08-13 18:45:21 回复(0)
select  distinct job,sum(num) as cnt from resume_info
where date like "2025%"
group by job
order by cnt desc;
发表于 2022-08-07 13:10:13 回复(0)
select job, sum(num) as cnt
from resume_info
where year(date) = '2025'
group by job
order by cnt desc
;

发表于 2022-07-12 09:41:52 回复(0)
select job,sum(num) as cnt
from resume_info
where year(date) = 2025
group by job 
order by cnt desc;
发表于 2022-06-15 10:46:15 回复(0)
YEAR(DATE) = 2015
使用year函数筛选具体年份
发表于 2022-06-07 17:41:31 回复(0)
刷到40多题怀疑人生了,来这道题寻求一下安慰🙄🙄🙄
发表于 2022-05-30 21:38:51 回复(0)
select a.job,sum(a.num) as cnt from 
(select * from resume_info where date between '2025-01-01' and '2025-12-31') a 
group by a.job order by cnt desc 
发表于 2022-05-22 16:37:39 回复(0)