Question 1

Top store for movie sales

Instruction

Write a query to return the name of the store and its manager, that generated the most sales.

Table: sales_by_store

Movie sales by store

  col_name   | col_type
-------------+----------
 store       | text
 manager     | text
 total_sales | numeric

Sample results

   store   |   manager
-----------+--------------
 Woodridge | Jon Stephens

Solution

postgres
SELECT store, manager
FROM sales_by_store
ORDER BY total_sales DESC
LIMIT 1;

Explanation

This query is selecting the store and manager columns from the sales_by_store table. It is then ordering the results by the total_sales column in descending order. Finally, it is limiting the results to only return the top row, which will have the highest total_sales value. Essentially, this query is finding the store and manager with the highest total sales.

Copied

Last Submission

postgres

No submission yet for this engine. Run and submit your query to save it here.

Copied
Expected results

Submit a query to compare against expected output.