Which TransactSQL statement should you use?

You have tables named Sales.SalesOrderDetails and Sales.SalesOrderHeader.
You have been tasked to update the discount amounts for the sales of a particular salesperson. You
need
to set UnitPriceDiscount to .1 for all entries in Sales.SalesOrderDetail that only correspond to
SalesPersonID 290. Which TransactSQL
statement should you use?

You have tables named Sales.SalesOrderDetails and Sales.SalesOrderHeader.
You have been tasked to update the discount amounts for the sales of a particular salesperson. You
need
to set UnitPriceDiscount to .1 for all entries in Sales.SalesOrderDetail that only correspond to
SalesPersonID 290. Which TransactSQL
statement should you use?

A.
UPDATE d SET UnitPriceDiscount = .1
FROM
Sales.SalesOrderDetail d
INNER JOIN
Sales.SalesOrderHeader h
ON h.SalesOrderID = d.SalesOrderID
WHERE h.SalesPersonID = 290;

B.
UPDATE Sales.SalesOrderDetail SET UnitPriceDiscount = .1
FROM Sales.SalesOrderHeader h
WHERE h.SalesPersonID = 290;

C.
UPDATE Sales.SalesOrderDetail SET UnitPriceDiscount = .1
WHERE EXISTS (
SELECT * FROM Sales.SalesOrderHeader h
WHERE h.SalesPersonID = 290);

D.
UPDATE Sales.SalesOrderDetail SET UnitPriceDiscount = .1
FROM Sales.SalesOrderDetail d
WHERE EXISTS (
SELECT * FROM Sales.SalesOrderHeader h
WHERE h.SalesPersonID = 290);



Leave a Reply 0

Your email address will not be published. Required fields are marked *