Fun Friday: SQL Interview Question

Test your SQL analysis skill.

An order can have multiple lines – For example, if a customer ordered cookies, chocolates, and bread, this would count as 3 lines in one order.  The question is to find the number of orders in each line count.  The output of this query would be something like 100 orders had 1 line, 70 orders had 2 lines, 30 had 3 lines, and so on.  This table has two columns – order_id and line_id.

Write your answer in the comments 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *