Consider the following tables EMPLOYEE and DEPARTMENT and answer (a) and (b) parts of this question.
1. Write SQL commands for the following statements:
(i) To display all DepName along with the DepCde in descending order of DepCde.
(ii) To display the average age of Employees in DepCde as 103.
(iii) To display the name of DepHead of the Employee named “Sanjeev P”
(iv) To display the details of all employees who has joined before 2007 from EMPLOYEE table.
2. Give the output of the following SQL queries:
(i) SELECT COUNT (DISTINCT DepCde) FROM EMPLOYEE;
(ii) SELECT MAX(JoinDate), MIN (JointDate) FROM EMPLOYEE;
(iii) SELECT TName, DepHead FROM EMPLOYEE E, DEPARTMENT D
WHERE E.DepCde = D.DepCde;
(iv) SELECT COUNT (*) FROM EMPLOYEE WHERE Salary > 60000 AND Age > 30;