Which join predicate should you use?

You are a database developer. You plan to design a database solution by using SQL Server 2008. You have a database that contains a table and a table-valued function. The table-valued function accepts the primary key from the table as a parameter. You plan to write a query that joins the table to the results of the table-valued function. You need to ensure that only rows from the table that produce a result set from the table-valued function are returned. Which join predicate should you use?

You are a database developer. You plan to design a database solution by using SQL Server 2008. You have a database that contains a table and a table-valued function. The table-valued function accepts the primary key from the table as a parameter. You plan to write a query that joins the table to the results of the table-valued function. You need to ensure that only rows from the table that produce a result set from the table-valued function are returned. Which join predicate should you use?

A.
CROSS APPLY

B.
OUTER APPLY

C.
INNER JOIN

D.
LEFT OUTER JOIN

Explanation:
CROSS APPLY returns only those rows in the outer table for which the table value function returns data.

OUTER APPLY operator returns all rows from the outer table, whether or not the function returns data for a specific row.



Leave a Reply 0

Your email address will not be published. Required fields are marked *