SQL: Analyzing business metrics 11 step 1


#1

I got so confused by this problem. These are the codes,

select name, COUNT(DISTINCT order_id)
from order_items
group by 1
order by 1;

It kept saying I'm wrong, for I didn't 'Count the product orders'.
Need help!!! I can't even proceed to the 2nd step.


#2

It looks like something is broken with the code checker.

Try using your same code, but with all lowercase:

select name, count(distinct order_id)
from order_items
group by 1
order by 1;

#3

That solved it. The code must be exactly the same as shown above, although other variations will get the same results (e.g. capitalization, renaming the count)

Should be reported as a bug though


#4

You can use the in-exercise bug reporting tool, if you haven't already.


#5

A post was split to a new topic: [reported] SQL: Analysing Business Metrics - 1. Introduction - GET CODE gives wrong code


#6

So nice to find this problem, really great help.
I am stuck in it for long time.


#7

Same issue for me, my code was count(distinct(order_id) and it wasn't accepted until I put it in as count(distinct order_id), despite getting the same results.