CWIVE
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Lab11 hints

向下

Lab11 hints Empty Lab11 hints

發表  軒仔 周四 11月 20, 2008 7:42 pm

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')

軒仔

文章數 : 28
注冊日期 : 2008-03-29
來自 : Class B

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章