Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Total Sales Calculation | Aggregating and Grouping Data
SQL for Data Analysis
Section 2. Chapter 1
single

single

bookChallenge: Total Sales Calculation

Swipe to show menu

Task

Swipe to start coding

Write a SQL query against the sales table that returns two summary metrics in a single row.

  • Return exactly one row with two columns:
    • total_sales — total number of rows in the table, using COUNT(*)
    • total_quantity — total sum of the quantity column, using SUM(quantity)
  • Use a single SELECT statement with no subqueries
  • Do not use WHERE, GROUP BY, or any filtering — aggregate the entire table
  • Column aliases must match exactly: total_sales and total_quantity

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 1
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt