exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 111 discussion

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

Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section. You will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have a database that tracks orders and deliveries for customers in North America. The database contains the following tables:

Sales.Customers -


Application.Cities -


Sales.CustomerCategories -

Your company is developing a new social application that connects customers to each other based on the distance between their delivery locations.
You need to write a query that returns the nearest customer.
Solution: You run the following Transact-SQL statement:
SELECT TOP 1 B.CustomerID, A.DeliveryLocation.STDistance(B.DeliveryLocation) AS Dist

FROM Sales.Customers AS A -

CROSS JOIN Sales.Customers AS B -
WHERE A.CustomerID = @custID AND A.CustomerID <> B.CustomerID

ORDER BY Dist -
The variable @custID is set to a valid customer.
Does the solution meet the goal?

  • A. Yes
  • B. No
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
Scooter123
Highly Voted 5 years, 7 months ago
It seems working
upvoted 11 times
...
Jiacheng
Highly Voted 5 years, 4 months ago
it is just same to the previous one, both answer should be A
upvoted 10 times
...
Billybob0604
Most Recent 4 years, 5 months ago
Same as the previous question. this runs perfectly.
upvoted 1 times
...
kiri2020
4 years, 8 months ago
looks the same as Question #100
upvoted 1 times
...
getstoopid
4 years, 10 months ago
A (YES) is correct
upvoted 2 times
...
stm22
4 years, 11 months ago
mlourinho's code runs...
upvoted 1 times
...
dgoo7
5 years ago
STDistance gives shortest path between 2 geographies, where in the asking 2 points in two different geographies. Example STDistance will give shortest distance between 2 continents where as ShortestLinto will give shortest path two different cities within the geopgraphy
upvoted 1 times
...
dgoo7
5 years ago
STDistance gives shortest path between 2 geographies, where in the asking 2 points in two different geographies. Example STDistance will give shortest distance between 2 continents
upvoted 1 times
...
mlourinho
5 years, 7 months ago
IF OBJECT_ID ('TEMPDB..#Customer') IS NOT NULL DROP TABLE #Customer; GO CREATE TABLE #Customer( CustomerID INT IDENTITY (1,1) , DeliveryLocation GEOGRAPHY , LocationName VARCHAR(150) ); GO INSERT INTO #Customer(DeliveryLocation, LocationName) VALUES (geography::Point(38.7071, -9.13549, 4326), 'Lisboa') , (geography::Point(41.15, -8.61024, 4326), 'Porto') , (geography::Point(40.4165000, -3.7025600, 4326), 'Madrid') , (geography::Point(41.3887901, 2.1589899, 4326), 'Barcelona') -- SELECT * FROM #Customer DECLARE @CustID INT = 4 SELECT TOP 1 A.CustomerID, A.LocationName , A.DeliveryLocation.STDistance(B.DeliveryLocation) AS Distancia , B.CustomerID, B.LocationName FROM #Customer A CROSS JOIN #Customer B WHERE A.CustomerID = @CustID AND A.CustomerID <> B.CustomerID ORDER BY Distancia
upvoted 4 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 ...