Source Code
A. Display the name of departments. Each department should be displayed once.
SOLUTION :
SELECT DISTINCT(Dept) FROM EMPLOYEE;
B. Find the name and salary of those employees whose salary is between 35000 and 40000.
SOLUTION
SELECT Ename, salary FROM EMPLOYEE WHERE salary BETWEEN 35000 and 40000;
C. Find the name of those employees who live in guwahati, surat or jaipur city.
SOLUTION :
SELECT Ename, city FROM EMPLOYEE WHERE city IN(‘Guwahati’,’Surat’,’Jaipur’);
D. Display the name of those employees whose name starts with ‘M’.
SOLUTION :
SELECT Ename FROM EMPLOYEE WHERE Ename LIKE ‘M%’;
E. List the name of employees not assigned to any department.
SOLUTION:
SELECT Ename FROM EMPLOYEE WHERE Dept IS NULL;
F. Display the list of employees in descending order of employee code.
SOLUTION:
SELECT * FROM EMPLOYEE ORDER BY ecode DESC;
G. Find the average salary at each department.
SOLUTION :
SELECT Dept, avg(salary) FROM EMPLOYEE group by Dept;
No comments:
Post a Comment