1/13
A set of vocabulary flashcards covering SQL aggregate functions, grouping, and related clauses from the lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
DISTINCT
SQL keyword used in a SELECT statement to return only unique, non-duplicate values from a specified column.
Aggregate Functions
A family of SQL functions (COUNT, MIN, MAX, SUM, AVG) that summarize multiple rows and return a single value.
COUNT( )
Aggregate function that returns the number of non-NULL rows (or total rows with COUNT(*)) that match a query’s criteria.
MIN( )
Aggregate function that returns the smallest (minimum) value found in a specified column.
MAX( )
Aggregate function that returns the largest (maximum) value found in a specified column.
AVG( )
Aggregate function that returns the arithmetic mean (average) of all numeric values in a specified column.
SUM( )
Aggregate function that adds together all numeric values in a specified column and returns their total.
Alias (AS clause)
Optional keyword used to rename an output column (e.g., SUM(price) AS total_price) for clearer, program-friendly result labels.
GROUP BY
Clause that groups rows sharing the same values in specified columns so aggregate functions can be applied to each group, returning one row per group.
HAVING
Clause used with GROUP BY to filter groups based on aggregate conditions (e.g., HAVING COUNT(*) > 250).
Evaluation Order (MySQL)
In a SELECT, MySQL processes FROM → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT.
Subquery
A query nested inside another query; the inner query is executed first and its result is used by the outer query.
Inner Query
The nested (red) statement in a subquery that executes first and supplies results to the outer query.
Outer Query
The main query that surrounds a subquery and uses its returned result for further processing.