Add a category column


#1

I have a 'category' column, but the error message says "Add a category column."

It looks like the instructions and the code are correct, but there's an error parsing the submitted answer.

Did I do something wrong?

Code:

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 'tikka-masala'            then 'dinner'
      when 'chicken-parm'            then 'dinner'
      else 'other'
    end as category
from order_items
order by id
limit 100;

#2

case order_item.name


#3
  1. We'll build our own categories using a case statement. Complete the query below with a case condition of name that lists out each product, and decides its group.

#4

The list is missing one item, a grilled cheese sandwich.


#5

Thanks @mtf! That'll teach me not to type when I can simply copy / paste :smile: I think this does highlight a bug in Codecademy's parser, though. The problem had nothing to do with the category column.


#6

Typing is better practice, and it demonstrates errors we might be prone to commit, letting us work out our own wrinkles.


#7

I got the same error and i didnt miss grilled cheese:

select *,
case name
when 'kale-smoothie' then 'smoothie'
when 'banana-smoothie' then 'smoothie'
when 'orange-juice' then 'drink'
when 'grilled-cheese' then 'sandwich'
when 'tikka-masala' then 'dinner'
when 'chicken-parm' then 'dinner'
else 'other'
end
as category
from order_items
order by id
limit 100;

I still get the error, any help?


#8

Missing the blt sandwich.


#9

thanks @mtf was a stupid mistake


#10

What's wrong?

select *,
case name
when 'kale-smoothie' then
'smoothie'
when 'orange-juice' then
'drink'
when 'soda' then
'drink'
when 'blt' then
'sandwhich'
when 'grilled-cheese' then
'sandwhich'
when 'tikka-masala' then
'dinner'
when 'chicken-parm' then
'dinner'
else 'other'
end
as category
from order_items
order by id
limit 100;


#11

Missing banana smoothie in the selection.


#12

A post was split to a new topic: Category column shows up in the sidebar


#13