10 Grouping Data Flashcards

1
Q

Purpose of grouping data?

A

Dividing data into logical sets so you can perform aggregate (grouped) calculations on each group

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

How many columns can you have in a GROUP BY clause?

A

As many as you want which provides more granular control over how the data is grouped

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

How is a nested group in a GROUP BY clause summarized?

A

Data is summarized at the last specified group, which evaluates all specified columns together so you won’t get data back for each individual column level

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

What types of columns can be used in the GROUP BY clause?

A

It must be a retrieved column (from your select statement) or a valid expression.

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

What types of columns CANNOT be used in the GROUP BY clause?

A

It CANNOT be an aggregate function or an alias.

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

Which columns in your select statement must be present in the GROUP BY clause?

A

All of them, except for the aggregate calculation statements

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

If the grouping column contains multiple rows with a NULL value, what happens?

A

All of null VALUE rows will be grouped together

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

The GROUP BY clause must be placed in what location?

A

Between WHERE and ORDER BY
It must be after the WHERE clause and before the ORDER BY clause

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

What is the difference between the WHERE and HAVING filter?

A

WHERE filters rows
HAVING filters groups

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

When using a GROUP BY clause, what clause should also always be specified?

A

ORDER BY should always be specified to make sure the data will be sorted properly

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

What is the order in which SELECT statement clauses are to be specified?

A

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY

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