<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
Hi, I’ve been stuck on this exercise for over an hour and I can’t seem to find any help. Usually, after several attempts it will give me the solution but not in this case. Anyone spot what I did wrong?
<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Error: near line 1: near “select”: syntax error
<In this course, it often helps to include a screenshot of your whole web browser – that lets everyone see what you see. If you wish to include a screenshot, add it below this line.>
<If you wish to copy/paste in your code, you can use this next section. This will allow others to copy/paste your code for testing – something that they won’t be able to do with just a screenshot.>
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) /
sum(select amount_paid from order_items) * 100, 2)
AS pct
FROM order_items
GROUP BY 1
ORDER BY 2 desc;
<do not remove the three backticks above>