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?
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: