exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 200 discussion

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

HOTSPOT -
You are creating a training management application. You run the following Transact-SQL statement:

You must build a report that returns course identifiers and the average evaluation score for each course. The result set must include only one score for each employee for each course.
You need to create a query that returns the required data.
How should you complete the Transact-SQL statement? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:

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
imran
Highly Voted 5 years, 3 months ago
cant use distinct in group by clause
upvoted 5 times
...
Billybob0604
Most Recent 4 years ago
Asked: "one score for each employee for each course." so the group by should be on employee and course. I only see course.
upvoted 1 times
...
Vermonster
4 years, 1 month ago
This is a repeated question - better version earlier with all parameters mentioned
upvoted 1 times
...
sunz_1
4 years, 4 months ago
doe not mention employee at all
upvoted 2 times
kiri2020
4 years, 4 months ago
right, there is no option to fulfill the last request - The result set must include only one score for each employee for each course , so there are not enough options to build right query. AVG (distinct Eval) will remove duplicate evaluation even if two different people got same Eval for the same course, which is wrong.
upvoted 2 times
...
...
Anette
4 years, 8 months ago
in order to fulfill one evaluation for customer, I think there should be included broup by employeeid also
upvoted 1 times
...
Dieter
5 years, 5 months ago
Why not using AVG(DISTINCT(Eval) in order to fullfill the requirements (only one evaluation for each customer)?
upvoted 1 times
fe
5 years, 2 months ago
Then the AVG will be for distinct values in the Eval column. I guess that is not what is asked in the question
upvoted 8 times
MarcusJB
4 years, 11 months ago
I guess that's exactly what is asked for: don't include double entries in the average calculation and this clearly makes a difference. If you like to try it out: -- create table CREATE TABLE dbo.Evaluations ( EvaluationID INT NOT NULL, EmployeeID INT NULL, CourseID INT NULL, Eval INT NOT NULL ); -- insert demo data INSERT INTO dbo.Evaluations (EvaluationID, EmployeeID, CourseID, Eval) VALUES (1, 5, 1, 13), (2, 10, 2, 77), (3, 10, 2, 77), -- dupe from preceding line (4, 12, 2, 28), (5, 13, 1, 51); -- results SELECT CourseID, AVG(DISTINCT Eval) AS AvgWithDistinct, AVG(Eval) AS AvgWithoutDistinct FROM Evaluations GROUP BY CourseID; -- clean up DROP TABLE dbo.Evaluations; Output: CourseID AvgWithDistinct AvgWithoutDistinct 1 32 32 2 52 60 So "AVG(DISTINCT Eval)" is the right answer from my point of view.
upvoted 3 times
ricky59
4 years, 8 months ago
But this is assuming that duplicate employeeIDs will have the same eval score.
upvoted 3 times
...
Anette
4 years, 8 months ago
What if one employees evaluate with same course more than once? This means that it is calculated more than one score for one employee for one course
upvoted 1 times
Anette
4 years, 8 months ago
What if one employee evaluates same course more than once? This means that it is calculated more than one score for one employee for one course**
upvoted 1 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago