Interview patterns: first row per group, change over time, share of total · exercise 1 of 1 · free preview
First row per group: number the rows inside each group with ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...) and keep number 1. Unlike RANK, it never gives two rows the same number.
Show each customer's first order: customer_id, order_id and order_date. Ignore orders without a customer. If a customer has two orders on the same day, use the lower order_id. Order by customer_id.
Tables in this practice shop
customersproductsordersorder_items