[go: up one dir, main page]

0% found this document useful (0 votes)
85 views2 pages

DQL Assignment

The document contains 18 SQL queries that retrieve employee data from database tables. The queries select employee names, job titles, salaries, departments, hire dates, and other attributes. They filter on conditions like job type, commission amounts, and date ranges to return specific subsets of employee records.

Uploaded by

Nidhi Patankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views2 pages

DQL Assignment

The document contains 18 SQL queries that retrieve employee data from database tables. The queries select employee names, job titles, salaries, departments, hire dates, and other attributes. They filter on conditions like job type, commission amounts, and date ranges to return specific subsets of employee records.

Uploaded by

Nidhi Patankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.Display name, job, salary, and annual salary of all employees.

->select ename, job, sal, (sal*12) as 'annual salary' from employee;

2.Display all the different job types.

->select distinct job from employee;

3.Select the name and salary of all employees who are CLERK.

-> select ename, sal, job from employee where job="Clerk";

4.List the employee number, name, job title, salary and hire date of employees of
department number 20. on december 17, 1980.

-> select * from employee where deptno="20" and (hiredate='1980-12-17');

5.List the department name and department number for departments with numbers
greater than or equal to 20.

->select dname, deptno from department where deptno>= 20;

6.Select the name, salary and commission of employees whose commission is greater
than their salary

-> select ename, sal, comm from employee where comm> sal;

7.List the name, job title and salary of everyone hired during 1983

-> select ename, job, sal, year(hiredate) from employee where


year(hiredate)='1983';

8.List the names of employees where salaries are less than 5500

-> select ename, sal from employee where sal<'5500';

9.List the names and employee numbers of managers who earn more than 7500.

-> select ename, empno from employee where job='Manager' and (sal>7500);

10.Select the information about managers and the president from the EMP table.
Order by department number.

->select * from employee where job in ('Manager','president') order by


deptno;

11.List all the employee name that do not end in �S�

-> select ename from employee where ename!='%s';

12.List the employee names that start with �C�

-> select ename from employee where ename like 'c%';

13.List the name, job and department of everyone whose name falls in the
alphabetical range �C� to �L�

-> select ename, job, dname from employee e, department d where


e.deptno=d.deptno and ( ename between 'c%' and 'l%');
14.List employee details working in department 20, 30 or 40

-> select * from employee where deptno in ('20','30','40');

15.List of employees while names start with �T� and ends with �R�

-> select ename from employee where ename like 't%r';

16.Display all employees who are hired during 1983

-> select ename, job, year(hiredate) from employee where


year(hiredate)='1983';

17.Display the data as shown below for all employees.


SMITH HAS HELD THE POSITION OF CLERK IN DEPT 20 SINCE 13-JUN-83
ALLEN HAS HELD THE POSITION OF SALESMAN IN DEPT 30 SINCE 13-JUN-83

->select CONCAT(ename, ' HAS HELD THE POSITION OF ',JOB , ' IN DEPT ',deptNo,
' SINCE ', date_format(HireDate,'%d-%M-%Y')) from employee;

18.List of employees who do not get any commission.

-> select ename, job ,comm from employee where comm is null or comm=0;

You might also like