Which Transact-SQL query should you use?

You develop a Microsoft SQL Server database that contains a table named Products. The Products table has columns named ProductId, CategoryId, Name, and Price.
Product prices are often updated as follows:
For a single product by a specific value by using the ProductId column
For an entire category by a percentage by using the CategoryId column
You need to log the change price to a new table named PriceChange by using the ProductId’ ChangedValue, and ChangedDate columns. You also need to ensure that increases in price are recorded as positive values and decreases in price as negative values.
Which Transact-SQL query should you use?
A.

B.

C.

D.

microsoft-exams

2 thoughts on “Which Transact-SQL query should you use?

  1. They are the same, Louis – however, the Syntax in D is wrong. The SELECT clause should read “inserted.Price – deleted.Price”.

    The Explanation states that A and B are wrong as increases would be displayed as negative numbers.
    For D to display a positive number and for it to be the correct answer, the “deleted” and “inserted” need to be switched.

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.