SQL Aggregate Functions, Grouping and Joins - CBSE Class 12 Computer Science Notes, Diagrams and Solved Questions

Summarise data with MAX, MIN, AVG, SUM and COUNT, group rows with GROUP BY and filter groups with HAVING, then combine two tables with a Cartesian product, an equi-join and a natural join.

In this chapter

  • MAX, MIN, SUM, AVG and COUNT, and how they treat NULL
  • COUNT(*) versus COUNT(column) and COUNT(DISTINCT …)
  • GROUP BY to get one summary row per group
  • HAVING versus WHERE
  • Cartesian product of two tables: degree and cardinality
  • Equi-join with a condition on matching columns
  • Natural join and how it differs from an equi-join