exam questions

Exam DP-600 All Questions

View all questions & answers for the DP-600 exam

Exam DP-600 topic 1 question 11 discussion

Actual exam question from Microsoft's DP-600
Question #: 11
Topic #: 1
[All DP-600 Questions]

HOTSPOT -
You have a data warehouse that contains a table named Stage.Customers. Stage.Customers contains all the customer record updates from a customer relationship management (CRM) system. There can be multiple updates per customer.
You need to write a T-SQL query that will return the customer ID, name. postal code, and the last updated time of the most recent row for each customer ID.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Show Suggested Answer Hide Answer
Suggested Answer: Box 1: ROW_NUMBER()
Box 2: WHERE X = 1

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
R3D_ENGINEER
Highly Voted 1 year, 2 months ago
The correct query is: WITH CUSTOMERBASE AS ( SELECT CustomerID, CustomerName, PostalCode, LastUpdated, ROW_NUMBER() OVER(PARTITION BY CustomerID ORDER BY LastUpdated DESC) as X FROM LakehousePOC.dbo.CustomerChanges ) SELECT CustomerID, CustomerName, PostalCode, LastUpdated FROM CUSTOMERBASE WHERE X = 1
upvoted 36 times
semauni
6 months ago
Thanks, this makes sense. I was already wondering where the X was coming from, it appears part of the syntax is missing in the question.
upvoted 2 times
AdventureChick
4 months, 2 weeks ago
In the CTE, the X = is assigning the alias "X" to the value returned from the ROW_NUMBER statement. It's the same as using "AS X" to assign an alias.
upvoted 1 times
...
...
...
varun_r
Highly Voted 1 year, 1 month ago
Answer is RowNumber and X=1 -- No Brainer
upvoted 14 times
...
rohitrc8521
Most Recent 2 months ago
calm down guys, the given answer is correct!
upvoted 1 times
...
Rakesh16
5 months, 2 weeks ago
ROW_NUMBER() and where X=1
upvoted 1 times
...
jass007_k
6 months ago
ROW_NUMBER(), WHERE X =1
upvoted 1 times
...
7d97b62
9 months, 2 weeks ago
The answer is correct RowNumber and X=1
upvoted 1 times
...
Darshan6232
10 months, 3 weeks ago
Its straight forwarded. Provided answer is correct.
upvoted 1 times
...
stilferx
11 months, 3 weeks ago
IMHO, 1. Row_Number() 2. x = 1 It is a typical pattern. We are numerating by desc, and then filtering the first one (actually the last because of DESC order)
upvoted 3 times
...
TashaP
1 year, 2 months ago
ROW_NUMBER() + X = 1
upvoted 5 times
...
David_Webb
1 year, 2 months ago
First drop-down box: ROW_NUMBER() Second drop-down box: WHERE X = 1 As ORDER BY LastUpdated DESC was used, the first row will be the most recent row.
upvoted 5 times
...
Momoanwar
1 year, 2 months ago
Row_number X=1 Row_number give row position and start from 1
upvoted 5 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