PrepAway - Latest Free Exam Questions & Answers

Which of the following SELECT statement would you write?

You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database
named ProductsDB. The relevant part of the ProductsDB is shown in the following database
diagram:

You need to write a Transact-SQL query that display a single row in the following XML format:
<row ProductID=”1001″ Product=”Product Name”, Price=”24.99″ InStock=”16″
Supplier=”Company Name” Contact=”Contact Name” Phone=”346 959 2215″ />
Which of the following SELECT statement would you write?

PrepAway - Latest Free Exam Questions & Answers

A.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS
[InStock], CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
INNER JOIN Suppliers ON SupplierID = SupplierID
WHERE ProductID = 1001
FOR XML RAW

B.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS
[InStock], CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
INNER JOIN Suppliers ON SupplierID = SupplierID
WHERE ProductID = 1001
FOR XML

C.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS
[InStock], CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
INNER JOIN Suppliers ON SupplierID = SupplierID
WHERE ProductID = 1001
FOR XML AUTO

D.
SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS
[InStock], CompanyName AS [Supplier], ContactName AS [Contact], Phone
FROM Products
INNER JOIN Suppliers ON SupplierID = SupplierID
WHERE ProductID = 1001
FOR XML AUTO, RAW

Explanation:

3 Comments on “Which of the following SELECT statement would you write?

    1. ashok says:

      Option A FOR XML RAW appears means it should be ROW comes it is the Correct answer

      Let Discuss other option

      Option A FOR XML RAW appears means it should be ROW comes it is the Correct answer

      if FOR XML RAW Elements means it should be separate closed brackets appear

      Option B FOR XML syntax error come.

      Option B if XML AUTO means select column table name should be appear in output

      Option D XML AUTO,RAW not valid for this output syntax error come

      if XML PATH means table comes




      0



      0

Leave a Reply