PrepAway - Latest Free Exam Questions & Answers

Which results should the query produce?

You have two tables named dbo.Products and dbo.PriceChange. Table dbo.Products contains ten
products. Five products are priced at $20 per unit and have PriceIncrease set to 1. The other five products
are priced at $10 per unit and have PriceIncrease set to 0.
You have the following query:

INSERT dbo.PriceChange (ProductID, Change, ChangeDate)
SELECT ProductID, inPrice -delPrice, SYSDATETIME()
FROM
(
UPDATE dbo.Products
SET Price *= 1.1
OUTPUT inserted.ProductID, inserted.Price, deleted.Price
WHERE PriceIncrease = 1 ) p (ProductID, inPrice, delPrice);

You need to predict the results of the query. Which results should the query produce?

PrepAway - Latest Free Exam Questions & Answers

A.
Five rows are updated in dbo.Products.
Five rows are inserted into dbo.PriceChange.

B.
Five rows are updated in dbo.Products.
No rows are inserted into dbo.PriceChange.

C.
No rows are updated in dbo.Products.
Five rows are inserted into dbo.PriceChange.

D.
No rows are updated in dbo.Products.
No rows are inserted into dbo.PriceChange.


Leave a Reply