Questions Chapter 3
Questions Chapter 3
76 Index
E. SELECT ename,sal
FROM emp
ORDER BY sal DESC,ename ASCENDING;
Column
Name ID_NO NAME SALARY DEPT_NO HIRE_DATE
Key type PK FK
NN
Nulls/unique ,UU NN
FK table DEPARTMENT
FK column DEPT_NO
Data Type NUM VARCHAR2 NUM NUM DATE
Length 9 25 8,2 3
You want to display employee hire date from the earliest to latest.
Which SQL
statement would you use?
ENAME JOB
---------- ---------
ALLEN SALESMAN
WARD SALESMAN
JONES MANAGER
MARTIN SALESMAN
BLAKE MANAGER
…… 13 rows selected
Essentials of Oracle 77
2. Show ename , job and salary of all the employees except WARD,
BLAKE, TURNER, JONES. (Don’t use AND operator)
ENAME JOB SAL
---------- --------- ----------
SMITH CLERK 800
ALLEN SALESMAN 1600
MARTIN SALESMAN 1250
CLARK MANAGER 2450
SCOTT ANALYST 3000
KING PRESIDENT 5000
ADAMS CLERK 1100
JAMES CLERK 950
FORD ANALYST 3000
MILLER CLERK 1300
3. Display the ename, salary, and commission for all employees whose
commission amount is greater than their salary increased by 10%.
ENAME MONTHLY_SAL INCREASED_SAL COMM
---------- ----------- ------------- ----------
MARTIN 1250 1375 1400
4. Display the ename and job title of all employees who do not have a
manager.Chnage the name of Job Column as Work(Work should be
in the same case).
ENAME Work
----- ---------
KING PRESIDENT
8. Display all those employees from emp table who have two A’s in
their name.
ENAME
----------
ADAMS
9. Display the Net salary of all those employees whose monthly salary
is between 1000 and 3000 and they are working as SALESMAN. Net
salary is calculated based on following formula. (SAL + COMM –
zakat (2.5 % of SAL) + House rent (5% of SAL))
10. Display the 10 days salary for all those persons who don’t have
manager. Consider current salary for 30 days salary.
ENAME TEN_DAYS_SAL
---------- ------------
KING 1666.66667