K SAI NIROOP REDDY
19STUCHH010134
DATABASE MANAGEMENT SYSTEM
LAB ASSIGNMENT - 6
LAB PRACTICE ASSIGNMENT:
Create a table EMPLOYEE with following schema:
(Emp_no, E_name, E_address, E_ph_no, Dept_no, Dept_name,Job_id, Designation , Salary)
Insert values ;
Insert into EMPLOYEE values (1,'Ram','Hyderabad',34525,'D8','SALES',99,'MANAGER','1980-01-
19',25000),(2,'Aman','Banglore',23456,'D10','CSE',12,'CLERK','1981-12-17',5000),
(3,'James','Mumbai',46798,'D5','MECH',44,'ANALYST','1981-12-03',52000),
(4,'Sameer','Vizag',78654,'D20','ECE',104,'IT PROFF','1981-05-01',10000),
(12,'Sana','Chennai',23145,'D8','SALES',102,'PRESIDENT','2000-12-12',350000),
(6,'Harish','Hyderabad',67812,'D10', 'CSE', 12,'MANAGER','1990-06-04',25000);
K SAI NIROOP REDDY
19STUCHH010134
1. List the E_no, E_name, Salary of all employees working for MANAGER.
select Emp_no, E_name,Salary from EMPLOYEE where
designation='MANAGER';
2. Display all the details of the employee whose salary is more than the Sal of any IT
PROFF..
select * from EMPLOYEE where salary>all (select Salary from EMPLOYEE where
Designation='IT PROFF');
K SAI NIROOP REDDY
19STUCHH010134
3. List the employees in the ascending order of Designations of those joined after 1981.
select E_name,Designation,hiredate from employee where
date_format(hiredate,'%Y')>'1981' order by Designation asc;
4. . List the employees along with their Experience and Daily Salary.
select E_name,Salary as Salary_lakh_per_annum, mod(Salary,365) as
Daily_salary,concat((date_format(curdate(),'%Y')-date_format(hiredate,'%Y')),'yrs')as
Years_Experience from EMPLOYEE;
K SAI NIROOP REDDY
19STUCHH010134
5. . List the employees who are either ‘CLERK’ or ‘ANALYST’ .
select * from employee where Designation = 'CLERK' or Designation = 'ANALYST';
6. List the employees who joined on 1-MAY-81, 3-DEC-81, 17-DEC-81,19-JAN-80 .
select * from employee where hiredate in ('1981-12-17','1981-12-03 ','1981-05-01','1980-
01-19');
K SAI NIROOP REDDY
19STUCHH010134
7. List the employees who are working for the Deptno 10 or20.
select * from employee where Dept_no = 'D10' or Dept_no = 'D20' ;
8. . List the Enames those are starting with ‘S’ .
select * from employee where E_name like 'S%';
9. Dislay the name as well as the first five characters of name(s) starting with ‘H’
select substr(E_name,1,5) from employee where E_name like 'H%';
K SAI NIROOP REDDY
19STUCHH010134
10. . List all the emps except ‘PRESIDENT’ & ‘MGR” in asc order of Salaries.
Select * from employee where Designation not in
('PRESIDENT','MANAGER') order by salary asc;