PrepAway - Latest Free Exam Questions & Answers

4You plan to write a query for a new business report that will contain several nested queries.

4

You plan to write a query for a new business report that will contain several nested queries.

You need to ensure that a nested query can call a table-valued function for each row in the main query.

Which query operator should you use in the nested

query?

A. CROSS APPLY

B. INNER JOIN

C. OUTER JOIN

D. PIVOT

Explanation:

The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. The table-valued function acts as the right i

nput and the outer table expression acts as the left input. The right input is evaluated for each row from the left input and the rows produced are combined for the final output. The list of columns produced by the APPLY operator is the set of columns in t

he left input followed by the list of columns returned by the right input.

There are two forms of APPLY: CROSS APPLY and OUTER APPLY. CROSSAPPLY returns only rows from the outer table that produce a result set from the table-valued function. OUTER APPLY re

turns both rows that produce a result set, and rows that do not, with NULL values in the columns produced by the table-valued function.

References: https://technet.microsoft.com/en-us/library/ms175156(v=sql.105).aspx


Leave a Reply