What should you do?

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 relation ship to it self. Each child might also be aparent. 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?

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 relation ship to it self. Each child might also be aparent. 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?

A.
Write a query to return the first level, and then add a correlated subquery to get the remaining levels.

B.
Write a query to return the first level, and then use the CROSS JOIN operator to join the table back to it self to get the remaining levels.

C.
Create a common-table expression to return the first level and then union back to it self to get the remaining levels.

D.
Create a view that returns the first level, and then use the FULL OUTER JOIN operator to join the table back to the view to get the remaining levels.



Leave a Reply 0

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