CSc 4710/6710 Database Systems
Fall 2011
Homework 2
Due: September 26, 2011 (Monday)
Specify and execute the following queries in Oracle SQL.
- List the names of employees in department 5 who work more than 10 hours
per week on the ProductX project.
- List the names of employees who have a dependent with the same first name
as themselves.
- List the names of employees who are directly supervised by Franklin Wong.
- List the names of employees who work on every project.
- List the names of employees who do not work on any project.
- List the names and addresses of employees who work on at least one
project located in Houston but whose department has no location in Houston.
- List the names of department managers who have no dependents.
- List the names of employees whose supervisor's supervisor has
a social security number of 888665555.
- List the name(s) of employee(s) with the lowest salary.
- List the names of employees who work in the department that has an employee
with the highest salary among all employees.
- For each project, list the project name and the total hours per
week (by all employees) spent on the project.
- For each department, retrieve the department name and the
average salary of all employees working in that department.
- Retrieve the average salary of all female employees.
- For each department whose average employee salary is more than
$30,000, retrieve the department name and the number of employees
working for that department.
- Suppose that we want the number of male employees in each
department rather than all employees (as in the previous query).
Can we specify this query in SQL? Why or why not.
ORACLE DATABASE:
Use the following schema and data scripts to
create and load the database under Oracle.
companySchema.sql
companyData.sql
SUBMISSION INSTRUCTIONS:
Please include all queries in one file, hw2, and submit using the following
command:
sudo handin 2 hw2
You will be prompted for your password; You must see a SUCCESS message
for each file submitted. Please include your name at the top of the file
for identification purposes.