<aside> 💡 Composition
Also includes:
Important: SQL is based on bags (duplicates) not sets (no duplicates).
Functions that return a single value from a bag of tuples:
→ AVG(col) → Return the average col value.
→ MIN(col) → Return minimum col value.
→ MAX(col) → Return maximum col value.
→ SUM(col) → Return sum of values in col.
→ COUNT(col) → Return # of values for col.
Can almost only be used in the SELECT output list
COUNT, SUM, AVG supports DISTINCT
Project tuples into subsets and calculate aggregates against each subset.
Non-aggregated values in
SELECToutput clause must appear inGROUP BYclause.
<aside>
💡 HAVING: Filters results based on aggregation computation.
Like a WHERE clause for a GROUP BY
</aside>
LIKE is used for string matching.