Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Essentials of Oracle 95

96 Index

Q No 2 : Practical Questions :
1. Select ename , it’s manager’s ename , dname from dept table and
manager’s grade from salgrade table.

ENAME MANAGER_NAME MANAGER_DNAME MANAGER_GRADE


---------- ---------- -------------- -------------
JONES KING ACCOUNTING 5
BLAKE KING ACCOUNTING 5
CLARK KING ACCOUNTING 5
ADAMS SCOTT RESEARCH 4
SMITH FORD RESEARCH 4
FORD JONES RESEARCH 4
SCOTT JONES RESEARCH 4
JAMES BLAKE SALES 4
WARD BLAKE SALES 4
ALLEN BLAKE SALES 4
TURNER BLAKE SALES 4
MARTIN BLAKE SALES 4
MILLER CLARK ACCOUNTING 4

2. Display all those employees whose manager has letter A in their


name.

EMP_NAME MANGER_NAM
---------- ----------
ALLEN BLAKE
WARD BLAKE
MARTIN BLAKE
TURNER BLAKE
JAMES BLAKE
MILLER CLARK

3. Display employee name along with employee’s grade and


manager name along with manger’s grade.

ENAME GRADE ENAME GRADE


---------- ---------- ---------- ----------
SMITH 1 FORD 4
JAMES 1 BLAKE 4
ADAMS 1 SCOTT 4
Essentials of Oracle 95

WARD 2 BLAKE 4
MARTIN 2 BLAKE 4
MILLER 2 CLARK 4
TURNER 3 BLAKE 4
ALLEN 3 BLAKE 4
CLARK 4 KING 5
BLAKE 4 KING 5
JONES 4 KING 5

4. Display ename , deptno , sal from emp table and dname from
dept table. It should also display the dname and department no in
which no employees are working.

ENAME DEPTNO SAL DEPTNO DNAME


---------- ---------- ---------- ---------- --------------
CLARK 10 2450 10 ACCOUNTING
KING 10 5000 10 ACCOUNTING
MILLER 10 1300 10 ACCOUNTING
JONES 20 2975 20 RESEARCH
FORD 20 3000 20 RESEARCH
ADAMS 20 1100 20 RESEARCH
SMITH 20 800 20 RESEARCH
SCOTT 20 3000 0 RESEARCH
WARD 30 1250 30 SALES
TURNER 30 1500 30 SALES
ALLEN 30 1600 30 SALES
JAMES 30 950 30 SALES
BLAKE 30 2850 30 SALES
MARTIN 30 1250 30 SALES
40 OPERATIONS

5. Find out all the employees who are working in SALES and
RESEARCH department and their grade is between 3 and 5.

ENAME SAL DNAME GRADE


---------- ---------- -------------- ----------
TURNER 1500 SALES 3
ALLEN 1600 SALES 3
96 Index

BLAKE 2850 SALES 4


JONES 2975 RESEARCH 4
SCOTT 3000 RESEARCH 4
FORD 3000 RESEARCH 4

6. Display all those employees whose manager is working in


RESEARCH department.

EMP_NAME MANGER_NAM DNAME


---------- ---------- --------------
SMITH FORD RESEARCH
SCOTT JONES RESEARCH
ADAMS SCOTT RESEARCH
FORD JONES RESEARCH

7. Display all the employees working under BLAKE.

EMP_NAME MANGER_NAM
---------- ----------
ALLEN BLAKE
WARD BLAKE
MARTIN BLAKE
TURNER BLAKE
JAMES BLAKE

8. Display all the employees working under PRESIDENT.

ENAME JOB
---------- ---------
JONES MANAGER
BLAKE MANAGER
CLARK MANAGER
Essentials of Oracle 95

9. Display the name of employees who are working as a manager.


(Note :It is not necessary that their job type is manger but they
are manager of some other employee).

ENAME
----------
JONES
FORD
CLARK
SCOTT
BLAKE
KING
10. Select employee’s name , employee’s department name , employee
‘sgrade and also it’s manager’s ename , manager’s dname and
manager’s grade.

EMP_NAME EMP_DEPT EMP_GRADE MNG_NAME MNG_DNAME MNG_GRADE


---------- -------------- ---------- ---------- -------------- ----------
SMITH RESEARCH 1 FORD RESEARCH 4
JAMES SALES 1 BLAKE SALES 4
ADAMS RESEARCH 1 SCOTT RESEARCH 4
WARD SALES 2 BLAKE SALES 4
MARTIN SALES 2 BLAKE SALES 4
MILLER ACCOUNTING 2 CLARK ACCOUNTING 4
TURNER SALES 3 BLAKE SALES 4
ALLEN SALES 3 BLAKE SALES 4
CLARK ACCOUNTING 4 KING ACCOUNTING 5
BLAKE SALES 4 KING ACCOUNTING 5
JONES RESEARCH 4 KING ACCOUNTING 5
FORD RESEARCH 4 JONES RESEARCH 4
SCOTT RESEARCH 4 JONES RESEARCH 4

You might also like