Your company’s database contains Customers and Orders tables.
You have been tasked to write a SELECT statement that exposes the data as a valid and well-formed
XML document. The XML data must be attribute-based, and the order data XML must be nested in the customer data XML.
You need to write a SELECT statement to meet the requirements.
Which Transact-SQL statement should you use?
A.
SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o
ON c.CustomerID = o.CustomerID FOR XML RAW(‘Contact’), ROOT(‘ContactOrderDate’)
B.
SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID FOR XML PATH(‘ContactOrderDate’)
C.
SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o
ON c.CustomerID = o.CustomerID FOR XML AUTO
D.
SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o
ON c.CustomerID = o.CustomerID FOR XML AUTO, ROOT(‘ContactOrderDate’)