Professional Documents
Culture Documents
Lab 5
Lab 5
ID: 32115333015
DR. JIHAD
SUB: DATABASE
Homework 5
Part 1 : SUBQUERIES
SELECT Dname
FROM Dept
WHERE Deptno IN (
SELECT deptno
FROM Emp
GROUP BY deptno
HAVING COUNT(Empno) > 6
);
DNAME
Sales
2. Display the employees whose location which has at least one o in it.
4. Display empno,job and salary of all the Analyst who are earning more than any of
the manager
6. Display all the employees in 'Operations and Accounting' Dept. list the employees
who has salary greater than Miller
DEPTNO
30
20
10
Q2: Display the employee name, salary and department no for all the employees who
earn more than 3000 and who work in a department with name contains the character
C. (Use set operators).
Q3: Display the employee name and salary for employees who earn the same salary
as the maximum salary. Without using group functions.
SELECT E.ENAME, E.SAL
FROM EMP E
WHERE E.SAL = (
SELECT SAL
FROM (
SELECT SAL
FROM EMP
ORDER BY SAL DESC )
WHERE ROWNUM = 1
);
ENAME SAL
King-16 6500