Browse SQL Topics ▼

SUM & AVG Functions

📂 Summarizing Data 📘 Lesson 35 of 81

Calculate total numeric sums with SUM and arithmetic means with AVG, ignoring NULL values safely.

SUM & AVG Functions is an essential topic in SQL and relational database engineering.

Overview

Building on foundational principles introduced in count-function, mastering sum & avg functions provides the core mental model and practical query skills needed for production relational database engineering.

SELECT
    SUM(quantity) AS total_items_sold,
    ROUND(AVG(unit_price), 2) AS average_item_price
FROM order_items;

Key Concepts

  • Understand the fundamental syntax, conventions, and mental model.
  • Avoid common beginner traps, data type mismatches, and performance pitfalls.
  • Apply practical idioms directly in production applications.

[!TIP] Master this concept to build a rock-solid foundation. Next, proceed to min-max-functions.

Test your understanding of SUM & AVG Functions

Quick interactive practice questions with instant feedback.

Take Quiz →