Which action should you take?

You are a database developer on an instance of SQL Server 2008. You maintain a Research database that contains the following Category table:


The Category table contains a hierarchy of living things to the sub-species level. Each row in the Category table has a ParentCatID value that corresponds to the item’s parent classification in the hierarchy. The parent-child relationship represented by the CatID and ParentCatID columns is nested more than 20 levels. A sample of data in the Category is shown as follows:


You want to query the Category table and return a list of all living things, but only down to 5 levels of nesting. You want to accomplish this with a single query. You want to minimize the complexity of the query, but provide optimal performance.
Which action should you take?
A. Create a query that contains four subqueries.
B. Create a recursive CTE.
C. Create a query that uses the CROSS APPLY clause.
D. Create a query that returns a calculated hierarchyid value.

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.