Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create the tables for the COMPANY database in Oracle SQL. Make sure that all the constraints are enforced. The SQL statements can be downloaded
1. Create the tables for the COMPANY database in Oracle SQL. Make sure that all the constraints are enforced. The SQL statements can be downloaded from the Blackboard link company_create.htm. The script given to you will not compile because of circular references. You need to modify the script to make it work. Provide a solution with the least number of changes to the schema given to you. 2. After creating the tables, populate the COMPANY database with the data. Again, the SQL insert statements can be downloaded from the Blackboard link company_insert.htm. Once again, the script given to you will not execute due to circular references. Provide a solution with fewest changes to the SQL statements provided to you. You should not make any changes to the schema created in problem 1 to solve this problem. Each Problem 5pts each; 5X12 = 60 3. Specify the following queries on the from above database schema. Also, show the result of each query as it would apply to the database. a. Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ProductX project. b. List the names of all employees who have a dependent with the same first name as themselves. c. Find the names of all employees who are directly supervised by Franklin Wong'. d. For each project, list the project name and the total hours per week (by all employees) spent on the project. e. Retrieve the names of all employees who work on every project. f. Retrieve the names of all employees who do not work on any project. g. For each department, retrieve the department name and the average salary of all employees working in that department. h. Retrieve the average salary of all female employees. i. Find the names and addresses of all employees who work on at least one project located in Houston but whose department has no location in Houston. j. List the last names of all department managers who have no dependents. k. 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. 1. Suppose that we want the number of male employees in each department rather than all employees. Can we specify this query in SQL? Why or why not. 1. Create the tables for the COMPANY database in Oracle SQL. Make sure that all the constraints are enforced. The SQL statements can be downloaded from the Blackboard link company_create.htm. The script given to you will not compile because of circular references. You need to modify the script to make it work. Provide a solution with the least number of changes to the schema given to you. 2. After creating the tables, populate the COMPANY database with the data. Again, the SQL insert statements can be downloaded from the Blackboard link company_insert.htm. Once again, the script given to you will not execute due to circular references. Provide a solution with fewest changes to the SQL statements provided to you. You should not make any changes to the schema created in problem 1 to solve this problem. Each Problem 5pts each; 5X12 = 60 3. Specify the following queries on the from above database schema. Also, show the result of each query as it would apply to the database. a. Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ProductX project. b. List the names of all employees who have a dependent with the same first name as themselves. c. Find the names of all employees who are directly supervised by Franklin Wong'. d. For each project, list the project name and the total hours per week (by all employees) spent on the project. e. Retrieve the names of all employees who work on every project. f. Retrieve the names of all employees who do not work on any project. g. For each department, retrieve the department name and the average salary of all employees working in that department. h. Retrieve the average salary of all female employees. i. Find the names and addresses of all employees who work on at least one project located in Houston but whose department has no location in Houston. j. List the last names of all department managers who have no dependents. k. 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. 1. Suppose that we want the number of male employees in each department rather than all employees. Can we specify this query in SQL? Why or why not
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started