nerdexam
Microsoft

70-433 · Question #13

70-433 Question #13: Real Exam Question with Answer & Explanation

The correct answer is D. SELECT c.ContactName, o.OrderDate, o.RequiredDate. 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') Produce the following result: <ContactOrderDate> <Contact ContactName="Paul Henriot" OrderDate="1996-07-04T00:00:

Question

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?

Options

  • ASELECT c.ContactName, o.OrderDate, o.RequiredDate
  • BSELECT c.ContactName, o.OrderDate, o.RequiredDate
  • CSELECT c.ContactName, o.OrderDate, o.RequiredDate
  • DSELECT c.ContactName, o.OrderDate, o.RequiredDate

Explanation

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') Produce the following result: <ContactOrderDate> <Contact ContactName="Paul Henriot" OrderDate="1996-07-04T00:00:00" RequiredDate="1996-08-01T00:00:00" /> <Contact ContactName="Karin Josephs" OrderDate="1996-07-05T00:00:00" RequiredDate="1996-08-16T00:00:00" /> <Contact ContactName="Paula Wilson" OrderDate="1998-05-06T00:00:00" RequiredDate="1998-06-03T00:00:00" /> </ContactOrderDate> SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID FOR XML PATH('ContactOrderDate') Produce the following result: <ContactOrderDate> <ContactName>Paul Henriot</ContactName> <OrderDate>1996-07-04T00:00:00</OrderDate> <RequiredDate>1996-08-01T00:00:00</RequiredDate> </ContactOrderDate> <ContactOrderDate> <ContactName>Karin Josephs</ContactName> <OrderDate>1996-07-05T00:00:00</OrderDate> <RequiredDate>1996-08-16T00:00:00</RequiredDate> </ContactOrderDate> <ContactOrderDate> <ContactName>Paula Wilson</ContactName> <OrderDate>1998-05-06T00:00:00</OrderDate> <RequiredDate>1998-06-03T00:00:00</RequiredDate> </ContactOrderDate> SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID Produce the following result: <c ContactName="Paul Henriot"> <o OrderDate="1996-07-04T00:00:00" RequiredDate="1996-08-01T00:00:00" <c ContactName="Karin Josephs"> <o OrderDate="1996-07-05T00:00:00" RequiredDate="1996-08-16T00:00:00" <c ContactName="Paula Wilson"> <o OrderDate="1998-05-06T00:00:00" RequiredDate="1998-06-03T00:00:00" SELECT c.ContactName, o.OrderDate, o.RequiredDate FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID FOR XML AUTO, ROOT('ContactOrderDate') Produce the following result: <ContactOrderDate> <c ContactName="Paul Henriot"> <o OrderDate="1996-07-04T00:00:00" RequiredDate="1996-08-01T00:00:00" <c ContactName="Karin Josephs"> <o OrderDate="1996-07-05T00:00:00" RequiredDate="1996-08-16T00:00:00" <c ContactName="Paula Wilson"> <o OrderDate="1998-05-06T00:00:00" RequiredDate="1998-06-03T00:00:00" </ContactOrderDate>

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice
Your company's database contains Customers and Orders tables. You... | 70-433 Q#13 Answer | NerdExam