COUNT, SUM, AVG, MIN and MAX summarize rows.
COUNT, SUM, AVG, MIN and MAX summarize rows. Read the query line by line and identify the input table, the transformation, and the shape of the result before running it.
SELECT COUNT(*) AS order_count, SUM(amount) AS revenue FROM orders;
Before running the example, predict the output columns and whether the query returns one row, many rows, or possibly no rows.
In your own words, explain the main SQL feature in today’s lesson and why it answers the question.
Recall prompt: Use COUNT(*) and SUM(amount) in one SELECT. Close this page section mentally and explain the query from memory before proceeding.
Return the number of orders and the total order value.
Use COUNT(*) and SUM(amount) in one SELECT.