![](https://csdnimg.cn/release/download_crawler_static/86629632/bg1.jpg)
Oracle Queries
- Queries By Mr. Faruqh, Answers By Giridhar Ks
67, 88, 92, 95, 96, 102, 108, 117, 118, 119, 122, 125, 127, 131, 133, 134, 135, 137, 138, 139, 146, 149,
151, 155, 165, 168, 176, 188, 204, 208
ORACLE QUERIES NOT ANSWERED :
108, 118, 119, 122, 127, 131, 133, 134, 135, 137, 138, 146, 149, 151, 155, 176, 188, 204, 208
Queries 2 be checked 4 syntax : 165, 168.
Display all the information of the emp table.
Display unique jobs from EMP table.
SELECT DISTINCT Job FROM EMP GROUP BY Job ;
List the details of the emps in asc order of their salaries.
SELECT * FROM EMP
ORDER BY Sal ASC ;
List the details of the emps in asc order of the Deptnos and desc of Jobs.
SELECT * FROM EMP
ORDER BY Deptno ASC, Job DESC ;
Display all the unique job groups in the descending order
select unique job from emp order by job desc ;
Display all the details of all ‘Mgrs’
select * from emp where job = 'MANAGER' ;
List the emps who joined before 1981.
select * from emp where hiredate < '01-Jan-1981' ;
List the Empno, Ename, Sal, Daily Sal of all Employees in the ASC order of AnnSal.
SELECT Empno, Ename, sal, Sal/30 DailySal
FROM Emp ORDER BY Sal*12 ;
Display the empno , ename, job, hiredate, exp of all Mgrs
select empno, ename, sal,
months_between(sysdate,hiredate)/12 Exp
from emp where job = 'MANAGER' ;
List the empno, ename, sal, exp of all emps working for Mgr 7839.
select empno, ename, sal,
months_between(sysdate,hiredate)/12 Exp
from emp B where Mgr = 7839 ;
Display the details of the emps whose Comm. Is more than their sal.
select * from emp where comm > sal ;
List the emps in the asc order of Designations