Score
0
Watch 44 Star 256 Fork 69

xuthus / 数据库SQL实战SQLMIT

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
7.查找薪水涨幅超过15次的员工号emp_no以及其对应的涨幅次数t.md 499 Bytes
Copy Edit Web IDE Raw Blame History
xuthus authored 2019-08-13 08:38 . revise:content revision

查找薪水涨幅超过15次的员工号emp_no以及其对应的涨幅次数t

题目描述

查找薪水涨幅超过15次的员工号emp_no以及其对应的涨幅次数t

CREATE TABLE `salaries` (
`emp_no` int(11) NOT NULL,
`salary` int(11) NOT NULL,
`from_date` date NOT NULL,
`to_date` date NOT NULL,
PRIMARY KEY (`emp_no`,`from_date`));

答案

select emp_no,count(emp_no) t from salaries group by emp_no having count(emp_no) > 15

题解

分组后过滤

Comment ( 0 )

Sign in for post a comment