exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 138 discussion

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

Note: This question is part of a series of questions that use the same scenario. For your convenience, the scenario is repeated in each question. Each question presents a different goal and answer choices, but the text of the scenario is exactly the same in each question in this series.
You query a database that includes two tables: Project and Task. The Project table includes the following columns:

The Task table includes the following columns:

You plan to run the following query to update tasks that are not yet started:
UPDATE Task SET StartTime = GETDATE() WHERE StartTime IS NULL
You need to return the total count of tasks that are impacted by this UPDATE operation, but are not associated with a project.
What set of Transact-SQL statements should you run?

A.

B.

C.

D.

E.

F.

Show Suggested Answer Hide Answer
Suggested Answer: B

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
mlourinho
Highly Voted 5 years, 7 months ago
Actually, F is also right
upvoted 14 times
...
Prides
Highly Voted 5 years, 4 months ago
tested on computer, both B F are right
upvoted 5 times
...
TheDUdeu
Most Recent 4 years, 9 months ago
F doesnt work you are not inserting the TaskId you are deleting so B is the only one correct.
upvoted 2 times
sunz_1
4 years, 9 months ago
for UPDATES, inserted. and deleted. are equivalent
upvoted 3 times
...
...
chaoxes
4 years, 11 months ago
both B and F work fine, tested it. I would go with B create table task (taskid int identity(1,1) ,taskname varchar(100) ,parenttaskid int ,projectid int ,starttime datetime2(7) ,endtime datetime2(7) ,userid int ) insert into task values ('t1', null, null, null, null, '1') ,('t2', null, '2', null, null, '2') ,('t3', null, null, null, null, '3') ,('t4', null, '4', null, null, '4') ,('t5', null, null, null, null, '5') ,('t6', null, '6', null, null, '6') declare @startedTasks TABLE(TaskID int, ProjectID int) UPDATE task SET StartTime = GETDATE() OUTPUT inserted.TaskId, deleted.projectid INTO @startedTasks WHERE StartTime IS NULL SELECT COUNT(*) FROM @startedTasks where projectid IS NULL select * from @startedTasks select * from task
upvoted 2 times
...
Andi64
5 years, 4 months ago
A) is also working fine
upvoted 1 times
MarcusJB
5 years, 4 months ago
No, because it says "WHERE ProjectID is not null" which is the complete opposite. Just B and F work fine.
upvoted 1 times
...
...
Jiacheng
5 years, 4 months ago
Yes, both B and F give same result, because 1 record insert, 1 record delete. But I think the author wants us to find out which records is affacted before after updating. so B is more correct
upvoted 3 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 ...