exam questions

Exam DP-203 All Questions

View all questions & answers for the DP-203 exam

Exam DP-203 topic 2 question 18 discussion

Actual exam question from Microsoft's DP-203
Question #: 18
Topic #: 2
[All DP-203 Questions]

HOTSPOT -
You are building an Azure Stream Analytics job to identify how much time a user spends interacting with a feature on a webpage.
The job receives events based on user actions on the webpage. Each row of data represents an event. Each event has a type of either 'start' or 'end'.
You need to calculate the duration between start and end events.
How should you complete the query? 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:
Box 1: DATEDIFF -
DATEDIFF function returns the count (as a signed integer value) of the specified datepart boundaries crossed between the specified startdate and enddate.
Syntax: DATEDIFF ( datepart , startdate, enddate )

Box 2: LAST -
The LAST function can be used to retrieve the last event within a specific condition. In this example, the condition is an event of type Start, partitioning the search by PARTITION BY user and feature. This way, every user and feature is treated independently when searching for the Start event. LIMIT DURATION limits the search back in time to 1 hour between the End and Start events.
Example:

SELECT -
[user],
feature,
DATEDIFF(
second,
LAST(Time) OVER (PARTITION BY [user], feature LIMIT DURATION(hour,
1) WHEN Event = 'start'),

Time) as duration -

FROM input TIMESTAMP BY Time -

WHERE -
Event = 'end'
Reference:
https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-stream-analytics-query-patterns

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
Miris
Highly Voted 3 years, 4 months ago
correct
upvoted 44 times
...
ohana
Highly Voted 2 years, 12 months ago
Took the exam today. This question came out. Ans: DateDiff, Last
upvoted 27 times
romanzdk
2 years, 9 months ago
how do you know?
upvoted 2 times
assU2
2 years, 8 months ago
https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-stream-analytics-query-patterns#detect-the-duration-between-events
upvoted 13 times
...
...
...
Gikan
Most Recent 8 months, 3 weeks ago
Answer should be correct, because the link is there, but what a freak SQL is it? The original T-SQL is LAST_VALUE(COLUMN) OVER(ORDER BY ...)! If I search the internet for this solution, the only page where it exists is the link in the answer!
upvoted 2 times
...
kkk5566
1 year, 1 month ago
Ans: DateDiff, Last
upvoted 1 times
...
semauni
1 year, 2 months ago
Why is the answer to the second blank LAST() instead of TOPONE(), when this is about the startdate?
upvoted 1 times
[Removed]
1 year, 2 months ago
LAST gives the most recent event it contradicts the name.. ISFIRST gives the oldest event... TOP ONE is a aggregate function which requires ORDER BY mandatory more like a ranking function here no order by so eliminated
upvoted 4 times
...
...
Deeksha1234
2 years, 2 months ago
answer is correct
upvoted 2 times
...
RajeshAzure
2 years, 2 months ago
When Event ='Start' should not be there in this question
upvoted 1 times
...
PallaviPatel
2 years, 8 months ago
correct answer.
upvoted 1 times
...
hugoborda
3 years ago
The answer is correct
upvoted 3 times
...
mdalorso
3 years, 2 months ago
This is Stream Analytics Query Language, a little different than tsql https://docs.microsoft.com/en-us/stream-analytics-query/last-azure-stream-analytics
upvoted 5 times
AvithK
3 years, 2 months ago
so is the answer DATEDIFF+LAST incorrect then?
upvoted 1 times
Juan27
3 years, 1 month ago
DATEDIFF and LAST are correct, please refer to: https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-stream-analytics-query-patterns ("Detect the duration between events")
upvoted 4 times
...
...
...
vlad888
3 years, 3 months ago
The query has no sense, at least if it is T-SQL. Look: each row is end event or start event. How window function (Last() over partition) can get start event if there is where condition that filter out end event only???
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago