oracle practiced hand (a)

Practiced hand 001

1. List all departments have at least one employee of 
the SELECT DNAME from the WHERE deptno in the dept (the SELECT deptno from emp); 
the SELECT DNAME from the WHERE deptno in the dept (deptno from emp Group by the SELECT deptno the HAVING COUNT (the EMPNO)> = 1); 
a WHERE DNAME from Dept SELECT EXISTS (SELECT null from EMP WHERE a.DEPTNO = b.DEPTNO B); 
2. List pay wages than smith employee information select * from emp where sal> ( select sal from emp where ENAME = 'SMITH'); SELECT * from a EMP WHERE EXISTS (SELECT null from EMP WHERE a.sal B> b.sal and b.ename = 'SMITH');
3. List the names of all employees' names and their direct superiors the ENAME SELECT, (SELECT from the ENAME EMP WHERE A = a.EMPNO b.MGR) BOSS EMP from B; SELECT a.ename EMP, b.ENAME A BOSS from EMP, EMP WHERE a.MGR B = b.EMPNO (+) ;
4. list the names of all employees hired earlier than the date of the direct superior a.ename from EMP WHERE A SELECT a.HIREDATE <(SELECT HIREDATE from EMP WHERE a.MGR = b.EMPNO B);
5. The information listed in the employee name and department of these sectors select dname, b * from dept a ,. b = b.deptno the WHERE a.deptno emp;
6. list all the 'clerk' employee's name and department name select a.ename, b.dname from emp a, dept b where a.job = 'CLERK' and a. = b.deptno DEPTNO;
7. the various working lists names is greater than the minimum wage 1500 SELECT DISTINCT Job EMP from Group by Job HAVING min (SAL)> 1500; SELECT DISTINCT a Job from EMP WHERE SAL> 1500 and Not EXISTS (SELECT null from emp b where a.job = b.job and a.sal> b.sal);

  

Guess you like

Origin www.cnblogs.com/sjxbg/p/11363073.html