mysql中这样写GROUP BY和count居然不会出错?

mysql中这样写GROUP BY和count居然不会出错?_第1张图片

mysql中这样写GROUP BY和count居然不会出错?_第2张图片

mysql中这样写GROUP BY和count居然不会出错?_第3张图片

mysql中这样写GROUP BY和count居然不会出错?_第4张图片

mysql中这样写GROUP BY和count居然不会出错?_第5张图片

mysql中这样写GROUP BY和count居然不会出错?_第6张图片

SELECT * FROM salary;
SELECT deptId, MAX(sal) FROM salary;
SELECT empId, deptId, MAX(sal) FROM salary;
SELECT deptId, MAX(sal), AVG(sal) , MIN(sal) FROM salary GROUP BY deptId;
SELECT empId, deptId, MAX(sal) FROM salary GROUP BY deptId;
SELECT empId, deptId, MIN(sal) FROM salary GROUP BY deptId;
SELECT empId, deptId, AVG(sal) FROM salary GROUP BY deptId;
SELECT empId, deptId, SUM(sal) FROM salary GROUP BY deptId;
SELECT empId, deptId, COUNT(sal) FROM salary GROUP BY deptId;
SELECT * FROM salary;
SELECT
	COUNT(*),
	COUNT(1),
	COUNT(66),
	COUNT(88),
	COUNT(empId),
	COUNT(deptId),
	COUNT(sal),
	COUNT('aaa'),
	COUNT('bbb'),
	COUNT(0),
	COUNT(NULL)
FROM
	salary;

 

你可能感兴趣的:(mysql,数据库,GROUP,BY,count,GROUP,BY分组)