Published on

Leetcode - 612. Shortest Distance in a Plane

Authors
  • avatar
    Name
    Indo Yoon
    Twitter
Table of Contents

문제

[Loading...

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

LeetCode

](https://leetcode.com/problems/shortest-distance-in-a-plane/)

정답

SELECT ROUND(SQRT(
    POW(P1.x - P2.x, 2) + POW(P1.y - P2.y, 2)
    ),2) AS shortest
FROM Point2D AS P1
JOIN Point2D AS P2 ON P1.x != P2.x OR P1.y != P2.y
ORDER BY shortest ASC
LIMIT 1