Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --1
- select count (employee_id)
- from employees;
- --2
- select avg(salary)
- from pracownicy
- where job_id ='IT_PROG';
- --3
- select count(distinct first_name)
- from employees
- where first_name like 'A%';
- --4
- select avg(salary),min(salary),max(salary)
- from employees;
- --5
- select sum(salary), min(salary), max(salary), avg (salary)
- from employees
- where manager_id is not null;
- --6
- select sum(salary), job_id
- from employees
- group by job_id;
- --7
- select job_id ,count(job_id)
- from employees
- group by job_id;
- --8
- select avg(salary), count (employee_id), job_id
- from employees
- group by job_id
- having count (employee_id)>=3;
- --9
- select first_name, count(first_name)
- from employees
- group by first_name
- having count(first_name)>1
- order by count(first_name) desc;
- --10
- select avg(salary), department_id
- from employees
- group by department_id
- having avg(salary)>9000;
- --11
- select department_id,min(salary)- max(salary)
- from employees
- group by department_id;
- --12 blad
- select menager_id,max(salary)
- from employees
- group by
- order by menager_id;
- --13 blad
- select department_id, max(salary)
- from employees
- order by department_id
- --14 blad
- select count(department_id), department_id,count(distinct department_id)
- from employees
- group by department_id;
- --15
- select avg(distinct salary),department_id
- from employees
- group by department_id;
- --16
- select max(salary),department_id
- from employees
- group by department_id
- having department_id in (50,60,100);
- --17
- select min(salary), department_id
- from employees
- where last_name NOT LIKE '%o%'
- group by department_id;
- --18
- select min(salary),max(salary),department_id
- from employees
- group by department_id
- having count(department_id)<5;
- --19
- select department_id
- from departments
- group by department_id
- having count (department_id)>1;
- --20
- select min(hire_date),max(hire_date) department_id
- from employees
- group by department_id
- order by department_id;
- --21
- select count(employee_id),job_id
- from employees
- group by job_id
- order by 1 desc;
- --22
- select count(employee_id),job_id
- from employees
- group by job_id
- having count(job_id)>10;
- --23
- select count (employee_id), avg(salary), job_id
- from employees
- where hire_date not between to_date ('01-01-2005', 'dd-mm-yyyy') and to_date ('31-12-2005', 'dd-mm-yyyy')
- group by job_id;
- --24 blad
- select min(salary),menager_id
- from employees
- group by menager_id;
- --25a
- select job_id,avg(salary)
- from employees
- group by job_id
- having job_id in ('ST_CLERK','ST_MAN');
- --25b
- select job_id,avg(salary)
- from employees
- where job_id in ('ST_CLERK','ST_MAN')
- group by job_id;
- --26
- select max(salary)-min(salary),DEPARTMENT_ID
- from employees
- where DEPARTMENT_ID in (50,60,100)
- group by department_id;
- --27
- select avg(salary),department_id,
- from employees
- where department_id in(70,80,110)and not between hire_date to_date('01-01-2014','dd-mm-yyy')
- and hire_date to_date('31-12-2015','dd-mm-yyy'
- order by department_id;
- --28
- --29
- --30
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement