Calculate Total Sales Using SUM Function
📖 Scenario: You work at a small store that keeps track of sales in a table. You want to find out the total amount of money made from all sales combined.
🎯 Goal: Build a SQL query that calculates the total sales amount using the SUM function.
📋 What You'll Learn
Create a table called
sales with columns id (integer) and amount (integer).Insert three sales records with amounts 100, 200, and 300.
Write a SQL query that uses the
SUM function on the amount column.Select the total sum with an alias
total_sales.💡 Why This Matters
🌍 Real World
Stores and businesses often need to calculate total sales or revenue from their data.
💼 Career
Knowing how to use SUM and WHERE in SQL is essential for data analysis and reporting roles.
Progress0 / 4 steps