Professional Documents
Culture Documents
Labtask 2
Labtask 2
and
salary is 6000, 8400, 8600 and 6100.
Display the full name of each employee, and please note each name is right justify.
Labtask 1 (or)
select salary,job_id from employees where salary>4000 or job_id='IT PROG'
Labtask 2 (or)
select country_id,country_name from countries where country_name='Argentina' or
region_id=4;
Labtask 1 (NOTIN)
select employee_id,salary from employees where DEPARTMENT_ID not in (50,80);
Labtask 2 (NOTIN)
select * from job_history where job_id not in('IT_PROG','AC_ACCOUNT')
Examples
NOTIN example
Write a query to display first_name,job title form those employees whose job
title not in st_clerk and programmer.
Select first_name,job_id
From employees
Where job_id not in (�ST_CLERK�, �PROGRAMMER�)
Example1
select first_name,employee_id from employees where first_name ='Ellen' and
employee_id=174;
Example2
select employee_id,job_id,first_name,salary from employees where salary>1100 or
job_id='IT_PROG'
Example3
select first_name,last_name from employees where job_id='ST_CLERK' and
employee_id=131;
Ascending order
select country_name from countries order by country_name
Example1
select first_name,department_id,job_id,hire_date from employees order by hire_date
asc,first_name asc
Decending order
select country_name from countries order by country_name desc
Percedence Rule
Example1
select first_name,job_id,salary from employees where job_id='ST_CLERK' or job_id =
'IT_PROG' and salary > 6000
Example2
select first_name,job_id,salary from employees where (job_id='ST_CLERK' or job_id =
'IT_PROG') and salary > 6000