
My qn is at the bottom of the pic..
Its from an exam paper.. Really no ideal how to write the SQL statement.. Pls help.. Thanks..
Additional:
1. Write a query to display the name, job and salary for all employees who work in the ACCOUNTING department.
My ans: (pls check for me.. thanks guys)
SELECT e.ename, e.job, sal
FROM emp e, dept d
WHERE d.deptno = e.deptno
AND d.deptno IN (10)
2. Write a query to display the employee number, name, salary for all employees who earn more than the average salary of the ACCOUNTING department.
My ans:
SELECT e.empno, e.ename, e.sal
FROM emp e
WHERE e.sal >
(
SELECT AVG(sal)
FROM emp e, dept d
WHERE e.deptno = d.deptno
)







Linear Mode

35 OCZ Fans!
Join Now!