Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please correct my SQL attached, I believe it's the WHERE function because it runs correctly without it but I am not sure how to get

Please correct my SQL attached, I believe it's the WHERE function because it runs correctly without it but I am not sure how to get the desired outcome of the "2 top ranked"
Revise the query from the last problem: when there is a tie of quantity_rank, assign
the same rank to each tied row, but ensure that the next rank in the sequence is not
skipped. Filter the results to only show the rows of the top two quantity_rank.
Hint: consider using subquery.
c.customer_first_name,
c.customer_last_name,
cp.quantity,
DENSE_RANK() OVER (PARTITION BY c.customer_first_name, c.customer_last_name
FROM
customer c
JOIN customer_purchases cp ON c.customer_id = cp.customer_id;
WHERE quantity_rank =1 AND 2;
ORDER BY
c.customer_last_name,
c.customer_first_name,
quantity_rank;
image text in transcribed

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago