BAB 5
Example of Aggregates
Aggregates can be combined with a WHERE clause to produce more complex results. For example, the query SELECT AVG(age) FROM friend WHERE age >= 21 computes the average age of people age 21 or older. This prevents Dick Gleason from being included in the average computation because he is younger than 21. NULL values are not processed by most aggregates, such as MAX(), SUM(), and AVG(); they are simply ignored. However, if a column contains only NULL values, the result is NULL, not zero. COUNT(*) is different in this respect.
Aggregate | Function |
COUNT(*) SUM(colname) MAX(colname) MIN(colname) AVG(colname) | Count of rows total maximum minimum average |
Contoh Aggregates
0 komentar:
Posting Komentar
Isilah komentar dengan kata - kata yang sopan