Aggregate Functions and Grouping (SQL)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

flashcard set

Earn XP

Description and Tags

A set of vocabulary flashcards covering SQL aggregate functions, grouping, and related clauses from the lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

DISTINCT

SQL keyword used in a SELECT statement to return only unique, non-duplicate values from a specified column.

2
New cards

Aggregate Functions

A family of SQL functions (COUNT, MIN, MAX, SUM, AVG) that summarize multiple rows and return a single value.

3
New cards

COUNT( )

Aggregate function that returns the number of non-NULL rows (or total rows with COUNT(*)) that match a query’s criteria.

4
New cards

MIN( )

Aggregate function that returns the smallest (minimum) value found in a specified column.

5
New cards

MAX( )

Aggregate function that returns the largest (maximum) value found in a specified column.

6
New cards

AVG( )

Aggregate function that returns the arithmetic mean (average) of all numeric values in a specified column.

7
New cards

SUM( )

Aggregate function that adds together all numeric values in a specified column and returns their total.

8
New cards

Alias (AS clause)

Optional keyword used to rename an output column (e.g., SUM(price) AS total_price) for clearer, program-friendly result labels.

9
New cards

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.

10
New cards

HAVING

Clause used with GROUP BY to filter groups based on aggregate conditions (e.g., HAVING COUNT(*) > 250).

11
New cards

Evaluation Order (MySQL)

In a SELECT, MySQL processes FROM → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT.

12
New cards

Subquery

A query nested inside another query; the inner query is executed first and its result is used by the outer query.

13
New cards

Inner Query

The nested (red) statement in a subquery that executes first and supplies results to the outer query.

14
New cards

Outer Query

The main query that surrounds a subquery and uses its returned result for further processing.