从titles表获取按照title进行分组
从titles表获取按照title进行分组
http://www.nowcoder.com/questionTerminal/72ca694734294dc78f513e147da7821e
从titles表获取按照title进行分组,每组个数大于等于2,给出title以及对应的数目t。
CREATE TABLE IF NOT EXISTS "titles" (emp_no
int(11) NOT NULL,title
varchar(50) NOT NULL,from_date
date NOT NULL,to_date
date DEFAULT NULL);
输入描述:
无
输出描述:
title t Assistant Engineer 2 Engineer 4 省略 省略 Staff 3
题解:
SELECT title, COUNT(title) T FROM titles GROUP BY title HAVING T >= 2