Pivoting Flashcards
T/F Aggregate functions ignore NULL values.
True
COUNT( * ) is functionally equivalent to COUNT( column ) where column is a column that…
always returns a value (no NULLs).
Does the COUNT function ignore NULL values?
Yes
When pivoting non-aggregate functions and using MAX ( CASE … what else is necessary in your query?
the GROUP BY clause
If you wanted your query to return results whether a value was recorded on the flowsheet or not how might you accomplish this?
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.
What are the requirements for using the UNION set operator?
same # columns, in the same order, same data types
When using the UNION set operator which query decides the names of the columns?
The first SELECT clause
How can you make a UNION set operator query more efficient?
Use UNION ALL which allows duplicate values. UNION returns only distinct values.
What does the UNION set operator do?
appends two tables: returns a table that has all distinct rows of both of the original two tables.