nerdexam
Microsoft

70-433 · Question #82

You create and populate a table named SiteNavigation by using the following statements: CREATE TABLE SiteNavigation ( SiteNavigationId INT PRIMARY KEY, Linktext VARCHAR(10), LinkUrl VARCHAR(40)…

The correct answer is C. WHERE DistanceFromRoot >= 2. See the full explanation below for the reasoning.

Question

You create and populate a table named SiteNavigation by using the following statements:

CREATE TABLE SiteNavigation ( SiteNavigationId INT PRIMARY KEY, Linktext VARCHAR(10), LinkUrl VARCHAR(40), ParentSiteNavigationId INT NULL REFERENCES SiteNavigation(SiteNavigationId) ) You are tasked to write a query to list all site references that are more than two levels from the root node. The query should produce the following results:

LinkText LinkUrl DistanceFromRoot You have written the following query:

WITH DisplayHierarchy AS (SELECT LinkText, LinkUrl, SiteNavigationId, ParentSiteNavigationId, 0 AS DistanceFromRoot FROM SiteNavigation WHERE ParentSiteNavigationId IS NULL UNION ALL SELECT SiteNavigation.LinkText, SiteNavigation.LinkUrl, SiteNavigation.SiteNavigationId, SiteNavigation.ParentSiteNavigationId, dh.DistanceFromRoot + 1 AS DistanceFromRoot FROM SiteNavigation INNER JOIN DisplayHierarchy dh ON SiteNavigation.ParentSiteNavigationId = dh.SiteNavigationId) SELECT LinkText, LinkUrl, DistanceFromRoot FROM DisplayHierarchy You need to append a WHERE clause to the query. Which clause should you use?

Options

  • AWHERE DistanceFromRoot =2
  • BWHERE DistanceFromRoot < 2
  • CWHERE DistanceFromRoot >= 2
  • DWHERE DistanceFromRoot IN (2,3)

How the community answered

(43 responses)
  • A
    5% (2)
  • B
    7% (3)
  • C
    74% (32)
  • D
    14% (6)

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice