SQL: Analyzing Business Metrics - 9/12 Question #2 times out


#1

the website keeps freezing, the correct code is simple, but the server from CA wont let it continue. My solution is to add a “limit 10” at the end so it will run it fast.

Query
select
case name
when 'kale-smoothie' then 'smoothie'
when 'banana-smoothie' then 'smoothie'
when 'orange-juice' then 'drink'
when 'soda' then 'drink'
when 'blt' then 'sandwich'
when 'grilled-cheese' then 'sandwich'
when 'tikka-masala' then 'dinner'
when 'chicken-parm' then 'dinner'
else 'other'
end as category, round(1.0 * sum(amount_paid) /
(select sum(amount_paid) from order_items) * 100, 2) as pct
from order_items
group by category
order by 2 desc
limit 10;

#2

We could use a link to the exercise, if you please. Thank you.

CC not CA

CC not CA


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.