Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write SQL queries to answer the following questions: Write a query to list the employees first, and last name as well as their hire date

Write SQL queries to answer the following questions:
Write a query to list the employees first, and last name as well as their hire date and commission_pct. If the commission_pct is empty report 0 instead. Order by Last name alphabetically in ascending order.
Now repeat the previous query but report only the employees with
a. Employee_id larger than 150
b. First name that starts with the letter D
c. First name that includes the letter in any case and position
d. Last names alphabetically after Matos
e. Hire date after 01-MAR-06(the correct query will return 48 records)
f. salary between 10000 and 12000
g. job_id FI_ACCOUNT or SA_MAN
h.515 area code (the first three digits of their phone number) using the extract function
i. with an empty department_id
Find the average salary of employees
Assuming that the city tax for each employee is 3.8398 percent of the salary, calculate this tax for each employee. Then round this value to two decimals and name it Rounded_City_Tax. Order by Rounded_City_Tax descending
Count all the departments and also count all the departments without a manager.
Using the Job_History table report the job history of every employee in the form:
Employee_Id Job_Id FROM:Year_of_Start_Date TO: Year_of_End_Date
Hint: You need to extract the year of each of the dates and use a concatenation function to merge all the columns in the form presented above.
Find the employees who have neither commission_pct nor manager
Find the employees who either dont have a commission_pct or dont have a manager
Return the employees that are either IT_PROG with salary $8000 or more, or are FI_ACCOUNT. Write the query without using parenthesis (but use parenthesis to confirm the result).
B. Return the employees that are either IT_PROG or FI_ACCOUNT and in both cases have salary $8000 or more.
For each employee, list the manager_id, job_title, and salary. Order the results:
In ascending order of manager_id and then ascending order of salary
In ascending order of manager_id and then descending order of salary
In descending order of manager_id and then ascending order of salary
How many locations overall? How many locations in each country (report the country_ids and a count of locations with each country_id)?
Which country_ids have more than 2 locations associated with them?
How many employees in each department? Order by the number of employees to find the department with the most employees.
How many employees were hired each year?
B. How many employees were hired each year, if we only take into accounts hires of March? Is this requirement placed in the WHERE clause, the HAVING clause or both?
C. How many employees were hired each year, if we only take into accounts the years 2006 and later? Is this requirement placed in the WHERE clause, the HAVING clause or both?
D. How many employees were hired each year, if we only take into account the years with more than 2 hires? Is this requirement placed in the WHERE clause, the HAVING clause or both?
E. How many employees were hired each year in each department?
Extra Credit:
Can you use SQL to do basic arithmetic such as 2*3 and 5+7? Which table are you selecting from? Hint: find out what is DUAL pseudotable
Choose a submission type
Drag a file here, or click to select a file to upload
Drag a file here, or
Choose a file to upload
No file chosen
or
I agree to the tool's End-User License Agreement
This assignment submission is my own, original work

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

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago