Rank and running totals: window functions · exercise 1 of 1 · free preview
ROW_NUMBER() OVER (ORDER BY ...) numbers the rows in the order you give. Unlike GROUP BY, every row stays in the result.
Number the orders in date order. Show order_id, order_date and order_no, where order_no is 1 for the earliest order, 2 for the next, and so on. Use order_id to break ties. Order by order_no.
Tables in this practice shop
customersproductsordersorder_items