exam questions

Exam 70-761 All Questions

View all questions & answers for the 70-761 exam

Exam 70-761 topic 1 question 108 discussion

Actual exam question from Microsoft's 70-761
Question #: 108
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:

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: A 🗳️
ShortestLineTo (geometry Data Type) Returns a LineString instance with two points that represent the shortest distance between the two geometry instances. The length of the LineString instance returned is the distance between the two geometry instances.
STLength (geometry Data Type) returns the total length of the elements in a geometry instance.
References:
https://docs.microsoft.com/en-us/sql/t-sql/spatial-geometry/shortestlineto-geometry-data-type

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
Vermonster
4 years, 4 months ago
Yes, should use STDistance() and ORDER BY Dist DESC both
upvoted 1 times
Vermonster
4 years, 4 months ago
STLength is around a geographic shape whereas STDistance gives distance between points A and B
upvoted 1 times
Vermonster
4 years, 4 months ago
But they both work so OK - it is correct: DECLARE @g GEOGRAPHY=GEOGRAPHY::Point(47,123, 4326), @h GEOGRAPHY=GEOGRAPHY::Point(48,125, 4326) SELECT @g.ShortestLineTo(@h).STLength() SELECT @g.STDistance(@h)
upvoted 1 times
...
...
...
test12345678901
4 years, 4 months ago
NO: ORDER BY Dist DESC
upvoted 1 times
test12345678901
4 years, 4 months ago
My mistake ignore
upvoted 1 times
...
...
Andy7622
4 years, 4 months ago
Shouldn't we use STDistance() here instead of STLength()?
upvoted 1 times
...
lh2607
4 years, 4 months ago
Correctimundo
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