You are on page 1of 3

TASK:

1. Display the name and job title for everyone that's in the emp
table.
Select ename , job from emp;

2. Display the employee name, job, and salary for everyone that
does not belong to the job title "CLERK".
Query:
Select ename,job,sal from emp where job=! ‘CLERK’;

3. Display all columns for everyone whose dept no: equals 108.
Query:
Select * from emp where deptno=108;

4. Select all the data of employees who are being managed by the
manager having id equals to 7698.
Query:
Select * from emp where mgr=7698;

5. Write a query that displays employee name, employee number,


salary and department number for all the employee having salary
less than 1500 and job title is clerk.
Query:
Select ename,empno,sal,deptno from emp where sal<1500 AND
job=’CLERK’;

6. Write a query to display all the employees whose name starts


with letter B.
Query:
Select ename from emp where ename like ‘B%’;
7. Retrieve the ename, salary and job titles of all the employees
who are working either as DIRIGENTE or DOTTORANDO.
Query:
Select ename,sal,job from emp where job = ‘DIRIGENTE’ OR job=
‘DOTTORANDO’;
8. Display the name of all employees who have both an a and an e
in their name.
Query:
Select ename from emp where ename like ( ‘%A%’ AND ename like
‘%E%’);

9. Select all the data of employees that work in department 20,


department 30 or department 60.
Query:
Select * from emp where (dept no=20 OR
deptno=30 OR deptno=60);

10. Create a query that renames the ename column as emp_name.


Query:
ALTER TABLE emp RENAME column ename TO emp_name;

11. Create a query to display unique employee names from the emp
table.
Query:
Select distinct ename from emp;

12. Create a query to display ename and job title as single column
having column name as "information".( Hint: Use concatenation
operator)
Query:
Select ename || job “information” from emp;
13. Retrieve the record of an employee whose name begins with M
and whose salary is between 500 and 1000.
Query:
Select * from emp where ename like ‘M%’ AND sal between 100
and 500;

14.Retrieve all the records where the ename does not start with N
and salary is greater than or equals to 500 and job does not equal to
TECNICO.
Query:
Select * from emp where ename NOT like ‘N%’ AND sal >=500 AND
job!= ‘TECHNICO’;

You might also like