Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

is there a way to lower the query cost of this query SELECT s . staff _ id , CONCAT ( s . first _

is there a way to lower the query cost of this query
SELECT
s.staff_id,
CONCAT(s.first_name, '', s.last_name) AS staff_name,
SUM(p.amount) AS total_sales
FROM
staff s
LEFT OUTER JOIN
rental r ON s.staff_id = r.staff_id
LEFT OUTER JOIN
payment p ON r.rental_id = p.rental_id
LEFT OUTER JOIN
inventory i ON r.inventory_id = i.inventory_id
LEFT OUTER JOIN
film f ON i.film_id = f.film_id
WHERE
p.payment_date IS NOT NULL
AND f.description LIKE '%Boring%'
AND f.description LIKE '%Lumberjack%'
AND f.description LIKE '%New Orleans%'
GROUP BY
s.staff_id,
staff_name
ORDER BY
total_sales DESC;

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

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions