EMPLOYEE (AadhaarNo, Name, Address, Department, EmpID)
DEPENDENT (EmpID, DependentName, Relationship)
Use the EMP-DEPENDENT database to answer the following SQL queries:
(a) Find the names of employees with their dependent names.
Select E.Name, D.DependentName FROM EMPLOYEE E, DEPENDENT D
WHERE E.EmpID = D.EmpID;
(b) Find employee details working in a department, say, ‘PRODUCTION’.
SELECT * FROM EMPLOYEE WHERE Department = ‘PRODUCTION’;
(c) Find employee names having no dependent
SELECT Name FROM EMPLOYEE
WHERE EmpID NOT IN (SELECT EMPID FROM DEPENDENT);
(d) Find names of employees working in a department, say, ‘SALES’ and having exactly two dependents.
SELECT E.Name FROM EMPLO.YEE E, DEPENDENT D
WHERE E.EmpID = D.EmpID AND Department = ‘SALES’
GROUP BY E.EmpID
HAVING COUNT (D.EmpID) = 2;