Table: sales_by_store
Movie sales by store
col_name | col_type -------------+---------- store | text manager | text total_sales | numeric
Question 1
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
postgresSELECT 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.
Last Submission
postgresNo submission yet for this engine. Run and submit your query to save it here.
Submit a query to compare against expected output.
Interview timer
Recommended interview pacing
Easy: 5 min for direct warm-up style questions.
Medium: 10 min for multi-step interview queries.
Hard: 15 min for layered questions with tighter time pressure.
A common bar is solving about 2 medium-or-harder questions in a 30 minute interview.
5:00
Run your query to preview results here.