Answered step by step
Verified Expert Solution
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 commissionpct If the commissionpct is empty report instead. Order by Last name alphabetically in ascending order.
Now repeat the previous query but report only the employees with
a Employeeid larger than
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 MARthe correct query will return records
f salary between and
g jobid FIACCOUNT or SAMAN
h area code the first three digits of their phone number using the extract function
i with an empty departmentid
Find the average salary of employees
Assuming that the city tax for each employee is percent of the salary, calculate this tax for each employee. Then round this value to two decimals and name it RoundedCityTax. Order by RoundedCityTax descending
Count all the departments and also count all the departments without a manager.
Using the JobHistory table report the job history of every employee in the form:
EmployeeId JobId FROM:YearofStartDate TO: YearofEndDate
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 commissionpct nor manager
Find the employees who either dont have a commissionpct or dont have a manager
Return the employees that are either ITPROG with salary $ or more, or are FIACCOUNT. Write the query without using parenthesis but use parenthesis to confirm the result
B Return the employees that are either ITPROG or FIACCOUNT and in both cases have salary $ or more.
For each employee, list the managerid jobtitle, and salary. Order the results:
In ascending order of managerid and then ascending order of salary
In ascending order of managerid and then descending order of salary
In descending order of managerid and then ascending order of salary
How many locations overall? How many locations in each country report the countryids and a count of locations with each countryid
Which countryids have more than 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 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 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 and 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 EndUser License Agreement
This assignment submission is my own, original work
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