Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the COMPANY database, write the proper SQL Statements to answer the following queries using MySQL DBMS. To install MySQL Server in your own environment,

For the COMPANY database, write the proper SQL Statements to answer the following queries using MySQL DBMS. To install MySQL Server in your own environment, please see Web links posted on Course Web Site. Submit your SQL Statements along with the results of these queries in a Word (.docx) file along with the other components of this assignments in ZIP archive.

The SQL statements comprising the DDL to create the various COMPANY Database objects are provided to you on additional SQL Script file on the Homework Page along with these specs. You may load and execute the provided DDL and DML scripts into your own MySQL Database using the MySQL Workbench GUI tool or through the command line using the mysql CLI tool that gets installed along with MySQL Server. Make sure to follow the restrictions stated for individual queries. When a query asks for "name" of employees, retrieve both, the first and the last names.

1. Retrieve the name of each employee that works in the Research department. You are allowed to use only 1 table in any FROM clause.

2. List the ssn and the name of each employee that either works in department 5 or has a salary greater or equal to $35,000. You are allowed to use only one condition term in any WHERE clause; i.e., don't use AND/OR Boolean operations.

3. List the social security number of each employee that works on at least one of the projects 1, 2, and 3. You are allowed to use only one condition term in any WHERE clause.

4. Retrieve the names of all employees of the Research department who work more than 10 hours per week on the ProductX project.

5. Retrieve the names of all employees who work on all projects [every project] located in either Bellaire or Sugarland. That is, if p1, p2, and p3 are located in Bellaire; and p4 and p5 are located in Sugarland, the result should be an employee who works on p1, p2, p3, p4, and p5.

6. Find the names of all employees who work on at least one project located in Houston but whose department has no location in Houston.

7. For each department whose average employee salary is more than $30,000, retrieve the department name and the number of male employees working for that department.

8. Retrieve the names of all employees who work in the department that has the employee with the highest salary among all employees.

9. (a) Create a View ProjectInfo that has the project name, controlling department name, number of employees, and total hours worked per week on the project for each project with more than one employee working on it. (b) Show the contents of this view.

10. Retrieve the names of employees who make at least $10,000 more than the employee who is paid the least in the Company.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

Assessment of skills and interests.

Answered: 1 week ago

Question

Psychological, financial, and career counseling.

Answered: 1 week ago