1233789_ SQL PROBLEMS SET
1233789_ SQL PROBLEMS SET
SQL statements:
a. Retrieve the name, birth date and address of the employee(s)
whose name is “John B.
Smith
FROM Employee
sql
SELECT Employee.Name FROM Employee JOIN Department ON
Employee.DeptID = Department.DeptID WHERE Department.DeptName =
'Administration';
SELECT Employee.Name
FROM Employee
WHERE Employee.DeptID = 5
SELECT Employee.Name
FROM Employee
f. List the names of all employees who have a dependent with the
same first name as themselves.
FROM Employee
JOIN Dependent ON Employee.EID = Dependent.EID
FROM WorksOn
GROUP BY Project.ProjectName;
FROM Employee
FROM Employee
GROUP BY Department.DeptName
Result:
Name: John B. Smith
Birth Date: 1965-01-09
Address: 731 Fondren, Houston, TX
Employees in Department 4:
o Alicia J. Zelaya
o Jennifer S. Wallace
Employees:
o John B. Smith
o Franklin T. Wong
o Joyce A. English
o Ramesh K. Narayan
o James E. Borg
6. List the names of all employees who have a dependent with the
same first name as themselves.
Employees:
7. For each project, calculate the total number of employees who work for it
and the total number of hours that these employees work for the project.
Female employees: