You are on page 1of 8

select employee_id, first_name, job_id from

mach1.employee_master46 where job_id = (select


job_id from mach1.employee_master46 where
employee_id = 141);
select employee_id, first_name, job_id, salary from
mach1.employee_master46 where job_id = (select
job_id from mach1.employee_master46 where
employee_id = 141) and salary > (select salary from
mach1.employee_Master46 where employee_id =
143);
select last_name,job_id, salary from
mach1.employee_master46 where salary = ( select
Max(salary) from mach1.employee_master46);
select department_id, min(salary) from
mach1.employee_master46 where salary < (select
min(salary ) from mach1.employee_master46 where
department_id = 110) group by department_id;
select job_id, avg(salary) as salary from
employee_master46 group by job_id having salary =
(select max(salary) as salary from (select avg(salary) as
salary from mach1.employee_master46 group by
job_id) as Sal1);
select first_name, max(salary) as salary from
mach1.employee_master46 group by first_name having
salary in (select max(salary) from
mach1.employee_master46 group by department_id)
order by salary;
select first_name, job_id, salary from
mach1.employee_master46 where job_id NOT IN
("IT_PROG") and salary >all (select salary from
mach1.employee_master46 where job_id =
"IT_PROG");
select first_name, job_id, salary from
mach1.employee_master46 where job_id NOT IN
("IT_PROG") and salary <all (select salary from
mach1.employee_master46 where job_id =
"IT_PROG");
select employee_id, concat(first_name, " ", last_name)
as EMP_NAME, job_id, department_id from
mach1.employee_master46 where employee_id NoT in
( select manager_id from mach1.employee_master46);
select * from mach1.employee_master46 where
manager_id = (select manager_id from
mach1.employee_master46 where first_name =
"Kevin") and first_name != "Kevin";
select employee_id, first_name, salary from
mach1.employee_master46 where salary > (select
avg(salary) from mach1.employee_master46) order by
salary DESC;
Select employee_id, last_name,department_id from
employee_master46 where first_name like '%e%' and
department_id not in (select department_id from
employee_master46 where first_name not like "%e%" )
order by department_id;
select last_name, employee_master46.department_id,
job_id from employee_master46, department_master46
where employee_master46.department_id =
department_master46.department_id and location_id =
2500;
select employee_master46.department_id, first_name,
job_id from employee_master46 where department_id
= (select department_id from department_master46
where department_name = "Human Resources");
select last_name, salary from employee_master46
where manager_id= (select employee_id from
employee_master46 where first_name = 'Kevin') and
first_name != "Kevin";
select employee_id, last_name, salary from
employee_master46 where salary > (select avg(salary)
from employee_master46) and department_id in (select
department_id from employee_master46 where
last_name like '%u%');
select first_name, last_name, grade_level,salary from
employee_master46, job_grade_master46 where salary
between lowest_sal and highest_sal and first_name =
"Neena" and last_name = "Kochhar";
select first_name, last_name, hire_date from
employee_master46 where hire_date > (select hire_date
from employee_master46 where first_name = "Peter"
and last_name = "Vargas");
select last_name, country_name from
employee_master46, country_master46,
department_master46,location_master46 where
country_name = (select country_name from
employee_master46, department_master46,
location_master46, country_master46 where
employee_master46.employee_id = (select employee_id
from employee_master46 where first_name = "Shelly"
and last_name = "Higgins") and
employee_master46.department_id =
department_master46.department_id and
department_master46.location_id =
location_master46.location_id and
location_Master46.country_id =
country_master46.country_id) and
employee_master46.department_id =
department_master46.department_id and
department_master46.location_id =
location_master46.location_id and
location_master46.country_id =
country_master46.country_id;

select first_name, last_name, salary, job_id from


employee_master46 where salary > (select min(salary)
from employee_master46, job_master46 where
employee_master46.job_id = job_master46.job_id and
job_title = "Sales Representative" group by
employee_master46.job_id);
select first_name, last_name, department_id, salary,
manager_id from employee_master46 where
department_id = (select department_id from
employee_master46 where first_name ="Trenna" and
last_name = "Rajs") and First_name != "Tranna" and
last_name != "Rajs";
select employee_id, first_name, last_name,
department_id, salary, manager_id from
employee_master46 where manager_id = (select
manager_id from employee_master46 where first_name
="Trenna" and last_name = "Rajs");
select job_id from employee_master46 where
employee_id = 205;
select salary from employee_master46 where
employee_id = 205;
update employee_master46 set job_id = 'AC_MGR' and
salary = 12000 where employee_id = 114;
delete from employee_master46 where department_id =
(select department_id from department_master46 where
department_name like '%Public%');
select last_name from employee_master46,
department_master46, location_master46 where
employee_master46.department_id =
department_master46.department_id and
department_master46.location_id =
location_master46.location_id and
location_master46.city = (select city from
location_master46, employee_master46
,department_master46 where
location_master46.location_id =
department_master46.location_id and
department_master46.department_id =
employee_master46.department_id and first_name =
"Jennifer" and last_name = "Whalen");

You might also like