Lab11 hints
第1頁(共1頁)
Lab11 hints
1)
SELECT job, AVG(sal) AS "Average Salary" FROM emp GROUP BY job
2)
SELECT job, AVG(sal) AS "Average Salary >3000" FROM emp GROUP BY job HAVEING AVG(sal) >=3000
3)
SELECT job, AVG(sal) FROM emp GROUP BY job HAVING AVG(sal) > (SELECT AVG(sal) FROM emp WHERE job = 'MANAGER')
4)
SELECT job, AVG(sal) FROM emp JOIN salgrade ON sal BETWEEN losal AND hisal WHERE grade = 2 GROUP BY job
5)
SELECT deptno, AVG(sal) "Salary AVG" FROM emp NATURAL JOIN dept GROUP BY deptno ORDER By deptno DESC
6)
SELECT deptno, AVG(sal) FROM emp GROUP BY deptno HAVING AVG(sal) <= ALL (SELECT AVG(sal) FROM emp GROUP BY deptno)
7)
SELECT ename, job, sal FROM emp WHERE sal > (SELECT sal FROM emp WHERE job = 'PRESIDENT')
SELECT job, AVG(sal) AS "Average Salary" FROM emp GROUP BY job
2)
SELECT job, AVG(sal) AS "Average Salary >3000" FROM emp GROUP BY job HAVEING AVG(sal) >=3000
3)
SELECT job, AVG(sal) FROM emp GROUP BY job HAVING AVG(sal) > (SELECT AVG(sal) FROM emp WHERE job = 'MANAGER')
4)
SELECT job, AVG(sal) FROM emp JOIN salgrade ON sal BETWEEN losal AND hisal WHERE grade = 2 GROUP BY job
5)
SELECT deptno, AVG(sal) "Salary AVG" FROM emp NATURAL JOIN dept GROUP BY deptno ORDER By deptno DESC
6)
SELECT deptno, AVG(sal) FROM emp GROUP BY deptno HAVING AVG(sal) <= ALL (SELECT AVG(sal) FROM emp GROUP BY deptno)
7)
SELECT ename, job, sal FROM emp WHERE sal > (SELECT sal FROM emp WHERE job = 'PRESIDENT')
軒仔- 文章數 : 28
注冊日期 : 2008-03-29
來自 : Class B
第1頁(共1頁)
這個論壇的權限:
您 無法 在這個版面回復文章