Assignment 5 - Advanced SQL
Due: 3 May, 2010
Instructions:
These commands will create the product, assembly, department, and employee tables and populate them with data.
Data model for the above tables
Create the SQL to answer these questions:
1. List the product id, description and price for products that are composed of other products.
Remove duplicate rows.
2. List the product id, description, quantity, product price, and extended price
(price * quantity) of all products that compose the product with product id of 2000.
3. List the product id, product description, price, and the total cost to the company for
producing the product with product id of 2000?
4. List any product that is neither used in or is composed of other products.
5. List the department name, floor, phone, total salaries of employees that work in it,
and average salaries of employees that work in it for all departments.
6. List name (first and last) of any employee, and the name (first and last) of the
boss where an employee has a higher salary than their boss.
Also list the difference in salary.
What to turn in:
A print out of the SQL for each query, with the results of running that query.