Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!