Question: SELECT e . first _ name, e . last _ name, t . title, AVG ( s . salary ) AS average _ salary FROM

SELECT
e.first_name,
e.last_name,
t.title,
AVG(s.salary) AS average_salary
FROM
employees e
JOIN
salaries s ON e.emp_no = s.emp_no
JOIN
titles t ON e.emp_no = t.emp_no
JOIN
dept_emp de ON e.emp_no = de.emp_no
WHERE
s.from_date BETWEEN '1999-01-01' AND '2001-12-31'
AND t.to_date >'2001-12-31'
AND de.dept_no ='d005'
GROUP BY
e.first_name,
e.last_name,
t.title
HAVING
AVG(s.salary)>(SELECT AVG(salary)*1.2 FROM salaries WHERE from_date BETWEEN '1999-01-01' AND '2001-12-31')
ORDER BY
average_salary DESC;
a) Without using indexes, create histograms on one (or many) columns that will improve query performance. Show the query cost
(and query time) prior to the creation of the histograms and after the creation of the histograms
b) Explain the results. Were you able to show improvement? Why or why not?
c) If the WHERE clause could be modified with a different date range of your choosing, based on the data distribution, could you
achieve better performance?

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!