exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 124 discussion

Actual exam question from Microsoft's 70-762
Question #: 124
Topic #: 1
[All 70-762 Questions]

DRAG DROP -
You manage a database that includes the tables shown in the exhibit. (Click the Exhibit button.)
You plan to create a DML trigger that reads the value of the LineTotal column for each row in the PurchaseOrderDetail table. The trigger must add the value obtained to the value in the SubTotal column of the PurchaseOrderHeader table.
You need to organize the list to form the appropriate Transact-SQL statement.
Which five Transact-SQL segments should you use to develop the solution? To answer, move the appropriate Transact-SQL segments from the list of Transact-
SQL segments to the answer area and arrange them in the correct order.

Table diagram -

Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Create TRIGGER NewPODetail

Box 2: ON PurchaseDetail -

Box 3: AFTER INSERT AS -
Basic syntax:

CREATE TRIGGER trigger_name -
ON { table | view }
{ FOR | AFTER | INSTEAD OF }
{ [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }

AS -
{ sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME <method specifier [ ; ] > }
Box 4: Update PurchaseOrderHeader
SET SubTotal = SubTotal + LineTotal

FROM inserted -
Box 5: WHERE PurchaserOrderHeader.PurchaseOrderID=

Inserted.PurchaseOrderID -
The trigger must read the value of the LineTotal column for each row in the PurchaseOrderDetail table. The trigger must add the value obtained to the value in the
SubTotal column of the PurchaseOrderHeader table.
References:
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-2017

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Martiniis
Highly Voted 4 years, 8 months ago
Correct!
upvoted 9 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...