SQL: Analyzing business metrics 11 step 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.


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;


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


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


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


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


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.