Académique Documents
Professionnel Documents
Culture Documents
SELECT e.emp_id, e.name, e.department_id, d.department_id, d.departmentZZZ FROM employees e JOIN departments d ON (e.department = d.department) where e.department_id=130;
SELECT e.emp_id, l.address, d.department_location FROM location l JOIN employees e ON l.address = e.address JOIN departmentnew d ON e.department_id = d.department_id;
SELECT e.name, e.department_id, d.department FROM employees e RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id) ;
SELECT department_id, max(salary) FROM employees GROUP BY department_id HAVING avg(salary) > 20000;
SELECT department_id, MAX(salary) FROM employees GROUP BY department_id HAVING MAX(salary)>10000 order by max(salary);
SELECT ROUND(MAX(salary),0) "Maximum", ROUND(MIN(salary),0) "Minimum", ROUND(SUM(salary),0) "Sum", ROUND(AVG(salary),0) "Average" FROM employees;
SELECT name, department FROM employees WHERE salary > (SELECT salary FROM employees WHERE hire_date= 02-Jan-09);
select name, position, salary from employees where position=(select position from employees where emp_id=1036) and salary>=(select salary from employees where emp_id=1017);
SELECT name, position, salary FROM employees WHERE salary = (SELECT MIN(salary) FROM employees);
FROM employees GROUP BY department_id HAVING MIN(salary) > (SELECT MIN(salary) FROM employees WHERE department_id = 50);
SELECT department_id, MIN(salary) FROM employees GROUP BY department_id HAVING MIN(salary) >15000;
SELECT emp_id, name, position, salary FROM employees WHERE salary > ANY (SELECT salary FROM employees WHERE Position = 'Project Assistant') AND Position <> 'Project Assistant';
SELECT emp_id, name, position, salary FROM employees WHERE salary > ALL (SELECT salary FROM employees WHERE Position = 'Project Officer')
SELECT emp.name FROM employees emp WHERE emp.emp_id NOT IN (SELECT dept.department_id FROM employees dept);
SELECT emp_id, name FROM employees WHERE salary IN (SELECT salary FROM employees where salary between 20000 and 65000) ORDER BY salary;
select name, department_id, position from employees where department_id=(select department_id from employees where emp_id=1002);
select name, department_id,position from employees where DEPARTMENT_ID = (select DISTINCT department_id from employees where department ='Chemistry');
SELECT hire_date FROM employees ORDER BY salary; SELECT emp_id, name, salary, department_id FROM employees WHERE department_id = &department_num ;
select emp_id, name, &column_name from employees where &condition order by &condition desc;
WHERE &condition ORDER BY &order_column ; select count(emp_id), max(salary) from employees where salary
SELECT name, salary FROM ( SELECT name, Rank_salary over( ORDER BY salary DESC) salary_rank FROM employees ) WHERE salary_rank <= 15;
SELECT name,top 15 salary FROM employees order by salary desc; select rownum,name,salary from (select name,salary from employees order by salary desc) where rownum=3 order by salary asc;
SELECT TOP 6 salary FROM employees where salry=( SELECT DISTINCT TOP 6 salary FROM employees ORDER BY salary DESC) a ORDER BY salary; select max(salary) from employees where salary not in (select max(salary) from employees)a and salary <> a;
select max(salary) from employees where salary not in (select TOP(2) salary from employees order by salary desc)
select min(salary) from (select distinct salary from employees order by salary desc) where rownum=2;
select rownum,name,max(salary from (select name,salary from employees order by salary ) where rownum <=1;
SELECT TOP 3rd salary FROM ( SELECT TOP 3 salary FROM employees ORDER BY salary DESC )a ORDER BY salary ASC
select * from employees e where 1 =(select count(distinct salary) from employees where e.salary<=salary);
SELECT LEVEL,MAX(SALARY) FROM EMPLOYEES WHERE LEVEL IN (2,3) CONNECT BY PRIOR SALARY > SALARY GROUP BY LEVEL ASC;
select * from(select * from(select * from select distinct(salary)from employees order by salary desc ) where rownum < (&N+1) ) order by salary asc ) where rownum=1
SELECT emp_id, name, position, &column_name FROM employees WHERE &condition ORDER BY &order_column ;
select name, emp_id, salary from employees where emp_id=1002 and date='02-feb-09'; where salary in (select emp_id from employees where name='ashok kumar' and date=02-jan-09);
SELECT emp_id,name, hire_date,salary, ADD_MONTHS (HIRE_DATE, 10) TODAY from employees WHERE EMP_ID=1002;
SELECT emp_id,name, hire_date,salary, NEXT_DAY ('01-Aug-09', 'FRIDAY') AA from employees WHERE EMP_ID=1005;
SELECT hire_date,salary from employees where salary in(select name, NEXT_DAY ('01-Aug-09', 'FRIDAY') AA from employees where emp_id=1008);
SELECT emp_id, name, Position, &&column_name FROM employees where &condition ORDER BY &column_name;
SET VERIFY on SELECT emp_id, name, salary, department_id FROM employees WHERE emp_id = &employee_num;
SET FEEDBACK OFF TTITLE Employee|Report BTITLE Confidential BREAK ON position COLUMN position HEADING Job|Category COLUMN name HEADING Employee COLUMN salary HEADING Salary FORMAT $99,999.99 REM ** Insert SELECT statement SELECT position, name, salary FROM employees WHERE salary < 25000 ORDER BY position, name, salary;
INSERT INTO employees (NAME, EMP_ID, DEPARTMENT, PROJECT, POSITION, ADDRESS, SALARY, HIRE_DATE, DEPARTMENT_ID) VALUES ('&Name', '&emp_id','&departmment','&project', '&position', '&address','&salary', '&hire_date','&department_id');
UPDATE employees SET position = (SELECT position FROM employees WHERE emp_id = 1009), salary = (SELECT salary FROM employees WHERE emp_id = 1009)