Lab1 PL

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

SQL and PL/SQL Labs

Note: Save each Assignment in a file with name (day number-


assignment number)
Day 1
Assignments
1-Display the last name concatenated with the job id, separated by a comma and
space and name the column [Employee and Title] as alias
select last_name|| ' , ' || job_id as "Employee and Title"
from employees ;

2-Display the last name and salary for all employees whose salary is not in the
range of $1500 and $7000.
select last_name , salary
from employees
where salary not between 1500 and 7000;

3-Display the last name, salary and commission for all employees who earn
commissions, Sort data in descending order of salary and commissions.
select last_name, salary,COMMISSION_PCT
from employees
where COMMISSION_PCT is not null
order by salary desc,COMMISSION_PCT desc ;
4- Display the last name, job id and salary for all employees whose job id is
SA_REP or PU_MAN and their salary is not equal to $9500, $9000 or $8000
Select last_name,job_id,salary
From employees
Where job_id in('SA_REP' ,'PU_MAN') and salary not in(9500, 9000 , 8000);

5-Display all information about employees whose last name begin with letter 'S’
or letter ‘s’
Select*
From employees
Where upper (last_name) like upper('s%')
Or lower( last_name) like lower('s%');

6-Display all employees whose first name contains letter before last ‘e’ or ‘E’

select *
from employees
where upper( first_name) like ('_E%');

7- Write a query that displays the first three letters of the employee full name,
and the length of his full name.
select substr(first_name||' '||last_name,1,3)as"full name",length(first_name||' '||last_name)
as"full name"from employees;

You might also like