"if you encounter any errors in SAP, send me a screenshot at pramod@learntosap.com, and I will help you resolve the issue."

SQL SUM() Function Explained with Real Examples (Beginner’s Guide)

SQL TUTORIALS-

SQL SUM() Function

Introduction-


Trulli Trulli

How to Use SQL SUM() Function – Syntax, Examples, and GROUP BY

✅SUM() function adds up all the numeric values in a specified column...


Emoji Examples in HTML

🔸 Example Table: Orders

OrderID Customer Product Quantity Price
1 ANNI Mobile 1 30000
2 POOJA Laptop 1 35000
3 RAJ Tablet 1 40000

✅ Example 1: Total Sales Amount.



SELECT SUM(Price) AS TotalSales FROM Orders;

Result Show :-

TotalSales → 105000 |


✅ Example 2: Total Quantity Sold.



SELECT SUM(Quantity) AS TotalQuantity FROM Orders;


Result Show :-

TotalQuantity → 3 |


✅ Example 3: Total Sales by Product.



SELECT Product, SUM(Price) AS ProductSales
FROM Orders
GROUP BY Product;



Result Show :-

Emoji Examples in HTML

🔸 Example Table: Product

Product ProductSales
Laptop 1
Mobile 1
Tablet 1

✅ Example 4: Total Price by Customer.



SELECT Customer, SUM(Price) AS CustomerSpending
FROM Orders
GROUP BY Customer;

May Be Like Important Link-

-SQL Tutorial for Beginners – Introduction to SQL

-SQL TOP, LIMIT, FETCH FIRST or ROWNUM Clause

-SQL SELECT DISTINCT Statement Clause Explained with Examples

-SQL Wildcard Characters: Complete Guide with Examples