Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a SQL query to find the employees who work as FI _ ACCOUNT or ST _ CLERK, are in Southlake, Texas or Seattle, Washington,

Write a SQL query to find the employees who work as FI_ACCOUNT or ST_CLERK, are in Southlake,
Texas or Seattle, Washington, have more than 5 years of experience, and do not receive a
commission. Sort the results in ascending order of their department location. Return employee ID,
employee name, salary, and department name.
For this, you will have to create a new table called dept using subqueries. The structure and data for
this new table will come from the HR tables departments and locations. This new dept table should
contain only the info from locations and departments needed for the solution.
- First, use a subquery to create the structure for dept with no data.
- Then, populate the dept table using subqueries
- Last, create a solution using subqueries to retrieve the employees that comply with the query
request. Any subquery is valid if the result is as expected.
-
2. Use subqueries to write a SQL query to find the employees of grades 4 and 5(salary within the
defined ranges). Return all the information of employees and salary details, including grade, min,
and max for the corresponding salary.
For this, you will have to create a table sal_grade with 3 columns: grade (as PK), min, and max. Pick
the right domains according to the values in the following table
Populate this table with
Grade MIN MAX
G12,000.003,000.00
G23,001.004,000.00
G34,001.007,000.00
G47,001.0010,000.00
G510,001.0099,999.00
3. Find the information of employees whose salary is greater than the salary of the employee whose
phone number is 590.423.4568. Return all the information about the employees (Use subqueries)
4. Display a list of departments names, managers full names, and employees full names for the
departments of Finance, IT, and Purchasing. Use subqueries to determine the departments you
need.
5. Using the table sal_grade created in question 2. Write a SQL query to find those employees of
grades 2 to 4, working in the departments of Shipping or Sales, whose salaries are greater than the
salary of Kelly Chung, and who have been working at the company longer than Lindsey Smith.
Return complete information about these employees.
6. Write a query to retrieve employees who work in the same department as Payam Kaufling, and their
salary is higher than the salary of Hazel Philtanker. Exclude all those records where the first name
starts with either J or P. Return first name, last name, salary, and hire date.

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_2

Step: 3

blur-text-image_3

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What are the best practices for managing a large software project?

Answered: 1 week ago

Question

How does clustering in unsupervised learning help in data analysis?

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago