Highest earning product


You're given the following table showing information about product sales for an eCommerce company:

Table: product_info

product_id total_units_sold unit_price_usd
1234 10000 20
1235 7500 30
1236 7500 25
4454 8000 15
4432 2000 60
4430 11000 10
1299 9000 14

Using the table above, write a SQL query to return the product_id of the product with the highest gross earnings (units * price). Make sure your query is able to handle potential ties (e.g. if there is a tie, should return all product_ids that tie for the highest total gross earnings).

You can view/query the data in an interactive SQL fiddle here.


Access restricted

Subscribe to premium account to see the solution.

Get premium now