Pivoting Flashcards

1
Q

T/F Aggregate functions ignore NULL values.

A

True

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

COUNT( * ) is functionally equivalent to COUNT( column ) where column is a column that…

A

always returns a value (no NULLs).

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

Does the COUNT function ignore NULL values?

A

Yes

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

When pivoting non-aggregate functions and using MAX ( CASE … what else is necessary in your query?

A

the GROUP BY clause

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

If you wanted your query to return results whether a value was recorded on the flowsheet or not how might you accomplish this?

A

Use a CTE with an inner join and MAX( CASE to return your recorded values. Then left join to the CTE in your main query.

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

What are the requirements for using the UNION set operator?

A

same # columns, in the same order, same data types

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

When using the UNION set operator which query decides the names of the columns?

A

The first SELECT clause

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

How can you make a UNION set operator query more efficient?

A

Use UNION ALL which allows duplicate values. UNION returns only distinct values.

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

What does the UNION set operator do?

A

appends two tables: returns a table that has all distinct rows of both of the original two tables.

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