当前位置:网站首页>leetcodeSQL:612. Nearest distance on plane
leetcodeSQL:612. Nearest distance on plane
2022-06-12 01:47:00 【Review of the white speed Dragon King】

Ideas :
1. Add up the differences Descartes , And then calculate dis
2. use cast + decimal(15,2) Keep two decimal places order limit that will do
sql
# Write your MySQL query statement below
# Find out the two different points and their examples
# use cast Keep a few decimal places
select cast(dis as decimal(15,2)) shortest
from
(
select p1.x x1, p1.y y1, p2.x x2, p2.y y2, round(sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y)), 2) dis
from Point2D p1, Point2D p2
where p1.x != p2.x or p1.y != p2.y
) t
order by shortest
limit 1
summary :
cast(var as decimal(15,x))
边栏推荐
- Introduction to prism framework - Modular introduction
- Redis cluster + sentinel mode + replicas
- Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
- Dataset how to use dataset gracefully. After reading this article, you can fully understand the dataset in c7n/choerodon/ toothfish UI
- Freshman year: learning summary
- 如何提高广告的广告评级,也就是质量得分?
- Redis實現消息隊列的4種方案
- Data system provider Jidao technology joins dragon lizard community
- redis集群(cluster)+哨兵模式+主从(replicas)
- Applets 111111
猜你喜欢

Pyinstaller packaging Exe (detailed tutorial)

自适应搜索广告有哪些优势?

Four schemes for redis to implement message queue

Perceptron from 0 to 1

括号生成(回溯)

Redis cluster + sentinel mode + replicas

Unit tests in golang

pip运行报错:Fatal error in launcher: Unable to create process using

Why should a redis cluster use a reverse proxy? Just read this one

商城开发知识点
随机推荐
websocket 切后台10秒后 关闭掉了
Redis實現消息隊列的4種方案
Software engineering course: Chapter 2 software problem definition and feasibility analysis after class exercises
括号生成(回溯)
LeetCode LCP 07. 传递信息
Introduction to prism framework - Modular introduction
商城开发知识点
Perceptron from 0 to 1
Loop loop and CX
How to restore the redis cluster and retain the complete cluster data after changing the node IP
Spiral matrix (skill)
Comprehensive quality of teaching resources in the second half of 2019 - subjective questions
Advantages of Google ads
聯調這夜,我把同事打了...
pip运行报错:Fatal error in launcher: Unable to create process using
How to improve the advertising rating of advertising, that is, the quality score?
“中国东信杯”广西大学第四届程序设计竞赛(同步赛)
Why should a redis cluster use a reverse proxy? Just read this one
Annotate your own point cloud dataset with labelcloud open source tool as a tutorial of Kitti annotation format (support PCD and bin point clouds)
These three sentences make you not confused when you understand that you are an we media. I just do this. The monthly income of video has exceeded 10000 yuan