Highest earning product
You're given the following table showing information about product sales for an eCommerce company:
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.
Subscribe to premium account to see the solution.Get premium now