DBMS Lab Assignment - III
DBMS Lab Assignment - III
1. Display the last name and salary for any employee whose salary is not in the range of
5,000 to 10,000?
2. Display the last name and department number of all employees in departments 60 or 100
in ascending alphabetical order by last name.
3. To display the last name and salary of employees who earn between 5,000 and
12,000 and are in department 60 or 90. Label the columns Employee and
Monthly_Salary.
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
4. Create a report to display the last name, salary, and commission of all employees
who earn commissions. Sort data in descending order of salary.
5. Display the last name, job id, and salary for all employees whose job is IT-programmer
or finance manager and whose salary is not equal to 2,500, 3,500, or 7,000.
6. Display the last name, salary, and commission for all employees whose commission
amount is 20%.
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
7. Display the employee number, last name, salary, and salary increased by 15.5%
(expressed as a whole number) for each employee. Label the column New Salary
8. Modify above query to add a column that subtracts the old salary from the new
salary. Label the column Increase.
QUERY- select Ename, sal, EmpNo, round(sal+sal*.155-sal) AS increase from EMP;
9. Create a query that produces the following for each employee: employee last name and
salary is 3 times. Label the column Dream .
QUERY- select Ename, (sal*3) AS DreamSalary from EMP;.
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
10. Display the last name and manager id of those employees whose manager id is not 103. .
QUERY- select Ename, mgr from EMP where mgr!=2540;
11. Create a query to display the contents of those employees whose manager id is in the
range of 100 and 103.
QUERY- select * from EMP where mgr BETWEEN 7690 and 7700;
12. Create a query to display the contents of those employees whose commission pct is null.
QUERY- select * from EMP where comm is null;
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
13. Create a query to display the contents of those employees whose manager id is not null
from the department table.
Query - select * from EMP where mgr is not null ;
14. Create a query to see a listing of all rows for which manager _id is not 200.
QUERY- select * from EMP where mgr !=7698 ;
Aggregate functions -
15. Display sum of salary of employees working in the department 60.
QUERY- select sum(sal) from EMP where DeptNo=30 ;
17. How many tuples are stored in the relation employees? Also find the no. of records in
manager_id attribute.
QUERY- select COUNT(*), COUNT(mgr) from EMP;
19. Display the content of the employee from employees table whose first name start with
letter A.
QUERY- select * from EMP where ename LIKE 'A%';
20. Display the content of the employee from employees table whose first name start with A
end with letter r.
QUERY- select * from EMP where Ename LIKE 'A%N';
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
21. Display the content of the employee from the employees table whose first name starts
with letter A and it is 5 characters long.
QUERY- select * from EMP where Ename LIKE 'A ';
22. Display the content of the employee from employees table whose first name has substring
‘ar’.
QUERY- select * from EMP where Ename LIKE '%AR%';
23. Display the content of the employee from employees table whose first name end with
letter ‘ara’.
QUERY- select * from EMP where Ename LIKE '%ARD';
24. Display the content of the department from departments table whose department name
has substring ‘tr’ and manager id is either 200 or 1700.
QUERY- select * from EMP where Ename like 'AR%' AND mgr = 7600 OR mgr =
7839;
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)
26. Display the last name , first name, manager id and email of those employees whose email
contains exactly one character that appears between E and S.
QUERY- select Ename, mgr, DeptNo, HireDate from EMP where job LIKE'%L_S%'
Medicaps University
Department of Computer Science & Engineering Database
Management System (CS3CO39)