Aggregate function: take multiple inputs and return a single output
- AVG(), COUNT(), MAX(), MIN(), SUM()
- can only happen in the SELECT or HAVING clause
- ordering result of the aggregate function requires ORDER BY reference to the entire function
GROUP BY: allows for the aggregation of columns by some category
- must appear right after a FROM or WHERE statement
- you can use an aggregate function with it
- in the SELECT statement, columns must either have an aggregate function or be in the GROUP BY call
- WHERE statement should not refer to the aggregation result
HAVING: allows for filtering after aggregation
- WHERE cannot be used to filter based on aggregated results
'Development > SQL' 카테고리의 다른 글
[SQL 배우기] Section 8. Creating Databases and Tables (1) | 2024.03.12 |
---|---|
[SQL 배우기] Section 6. Advanced SQL Commands (0) | 2024.03.12 |
[SQL 배우기] Section 5. JOINS (0) | 2024.03.12 |
[SQL 배우기] Section 2. SQL Statement Fundamentals (0) | 2024.03.12 |
[SQL 배우기] Section 1. Course Introduction (0) | 2024.03.12 |