Which row will ROW_NUMBER keep for each product?

The query selects one record per product. Look at the sort order inside the window function and determine which rows will remain in the result.

Predict the resultDuplicates and top NJuniorAnalystData EngineerBackend
Input data · iv_order_items
idorder_idproductquantityprice
11pen102.00
21notebook110.00
32pen14.00
43notebook510.00
53bag150.00
64pen23.00
75pen310.00
87bag260.00
98notebook240.00

Query

SELECT product, id, price
FROM (
  SELECT product, id, price,
         ROW_NUMBER() OVER (
           PARTITION BY product
           ORDER BY price DESC, id ASC
         ) AS rn
  FROM iv_order_items
) AS ranked
WHERE rn = 1
ORDER BY product