SELECT
COUNT(gender) AS male_num,
AVG(gpa) AS avg_gpa
FROM user_profile
WHERE
gender = 'male'
The execution order of count(), where, and group by:
first where filtering, then group by grouping and splitting to generate a temporary table, and finally cout summing and merging temporary tables