nerdexam
Microsoft

70-451 · Question #39

You are a database developer. You plan to design a database solution by using SQL Server 2008. The database will contain a table that has a parent-child relationship to itself. Each child might also…

The correct answer is C. Create a common-table expression to return the first level and then union back to itself to. See the full explanation below for the reasoning.

Question

You are a database developer. You plan to design a database solution by using SQL Server 2008. The database will contain a table that has a parent-child relationship to itself. Each child might also be a parent. This might exist up to 10 levels deep. You need to retrieve all levels by using a single Transact-SQL query. What should you do?

Options

  • AWrite a query to return the first level, and then add a correlated subquery to get the
  • BWrite a query to return the first level, and then use the CROSS JOIN operator to join the
  • CCreate a common-table expression to return the first level and then union back to itself to
  • DCreate a view that returns the first level, and then use the FULL OUTER JOIN operator to

How the community answered

(52 responses)
  • A
    15% (8)
  • B
    8% (4)
  • C
    75% (39)
  • D
    2% (1)

Community Discussion

No community discussion yet for this question.

Full 70-451 Practice