More Grouping Flashcards

1
Q

What aggregate function counts all rows?

A

COUNT (*)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What aggregate function counts all non-NULL values?

A

COUNT (column_name)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What aggregate function averages all non-NULL values?

A

AVG (column_name)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What aggregate function returns the maximum (highest) value?

A

MAX (column_name)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What aggregate function returns the minimum (lowest) value?

A

MIN (column_name)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What aggregate function returns the sum (total) of all non-NULL values?

A

SUM (column_name)

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do aggregate functions do with NULL values?

A

Aggregate functions ignore NULL values.

Last Revised: 4/2/21, 2.5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What keyword can be used immediately after the SELECT keyword to indicate that you only want rows returned that have unique combinations of values in the column identified in the SELECT clause?

A

Use the keyword DISTINCT when you want unique values rather than all values.

(Last Revised: 4/2/21, 2.8)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The training companion lists two ways the use DISTINCT. What are they?

A
  1. Using DISTINCT in the SELECT clause to return rows that have unique combinations of values in the column identified in the SELECT clause
  2. Using DISTINCT with COUNT to return the number of unique values in the given column

(Last Revised: 4/2/21, 2. )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Can aggregate data be filtered on in the WHERE clause?

A

No
• Filter on aggregate data in the HAVING clause.

(Last Revised: 4/2/21, 2.10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Can the HAVING clause reference column aliases?

A

No
• The HAVING clause is processed before the SELECT clause.

(Last Revised: 4/2/21, 2.10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Is the HAVING clause processed before or after the WHERE clause?
Why is that relevant?

A

After
• The HAVING clause will work off of the data set the WHERE clause defined.

(Last Revised: 4/2/21, 2.10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which clause can be used to conditionally include/exclude groups from a query result?

A

The HAVING clause.

Last Revised: 4/2/21, 2.11

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How would you achieve the necessary granularity before the GROUP BY clause is processed?

A

By using joins in the FROM clause and the WHERE clause to filter out undesired data.

(Last Revised: 4/2/21)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How would you achieve the necessary granularity after the GROUP BY clause is processed?

A

By using the HAVING clause.

Last Revised: 4/2/21, 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True or False:
If a query is using the GROUP BY clause then the ONLY columns you can display (via the SELECT clause) will be the column(s) that are in the GROUP BY clause or are part on an aggregation.

A

True

Last Revised: 4/2/21, 2.