Which query should you execute?

You are a database developer on an instance of SQ`n the exhibit. (Click the Exhibit(s) button.)
You want to retrieve data from the Prospect table in XML format. You want the XML in the result set to meet the following requirements:
• A root <ProspectData> element should enclose the XML.
• Each prospect should be represented with a <Prospect> element that includes an ID and Name attribute.
• Each <Prospect> element should enclose a <Detail> element that includes subelements for the type and rating.
You want to accomplish this with the least amount of effort.
Which query should you execute?
Exhibit:


A. SELECT ID AS "@ID",
CompanyName AS "@Name",
Type AS "Detail/Type",
Rating AS "Detail/Rating"
FROM Prospect
FOR XML PATH(‘Prospect’), Root(‘ProspectData’);
B. SELECT AS Tag,
NULL AS Parent,
ID AS [Prospect!1!ID!element],
CompanyName AS [Prospect!1!Name],
Type AS [Prospect!1!Type],
NULL AS [Prospect!1!Rating]
FROM Prospect
FOR XML EXPLICIT ROOT(‘ProspectData’);
C. SELECT ID,
Type AS Type,
Rating AS Rating
FROM Prospect
FOR XML AUTO, TYPE, ROOT(‘ProspectData’);
D. SELECT ID AS "@ID",
Type AS "Type",
Rating AS "Rating"
INTO XMLOutputTbl
FROM Prospect
FOR XML PATH(‘Prospect’), Root(‘ProspectData’);

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.