1. Top store for movie sales

easy

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

Expected results

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.



More SELECT, WHERE, AND, OR, ORDER BY, LIMIT questions

ID Title Level FTPR
212 Top issuing bank by category visa hard -
211 High spenders by issuer visa easy -
210 Issuer and merchant report visa easy -
200 Last week's absent students snap medium -
175 Employees' email account amazon easy
11%
152 Salary analysis dropbox easy
23%
126 Top 3 restaurants uber hard
9%
111 Second most popular product amazon medium
14%
92 Acceptance rate first week of 2021 spotify easy
14%
17 GROUCHO WILLIAMS’ actor_id easy
65%
16 Staff who live in Woodridge easy
72%
4 Staff without a profile image easy
67%
3 Top 5 shortest movies easy
53%
2 Top 3 movie categories by sales easy
47%