Quiz Yourself: Additional Programming Constructs

Test your knowledge of advanced programming constructs in T-SQL.

Additional Programming Constructs Quiz

1

Consider this dbo.Items table and data:

Id Title Price QuantityLeft
1 Phone 250 5
2 Headphones 12 20
3 Case 5 23

Consider the following trigger:

CREATE TRIGGER dbo.Items_InsteadOfUpdate ON dbo.Items INSTEAD OF UPDATE
AS
BEGIN
    IF deleted.Id = 2
    BEGIN
        UPDATE dbo.Items
        SET Price = 15
        WHERE Id = 2
    END
END;

What is the price of the headphones after running the following query?

UPDATE dbo.Items
SET Price = 25
WHERE Id = 2
A)

12

B)

250

C)

25

D)

15

Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.