Joke Collection Website - Bulletin headlines - How to write and calculate the latitude and longitude distance of coordinates in sql statement? I am mysql database. Please be more specific! thank you

How to write and calculate the latitude and longitude distance of coordinates in sql statement? I am mysql database. Please be more specific! thank you

You can create a two-dimensional array in the system, store each coordinate as a two-dimensional array, and write a method to automatically calculate the distance between two coordinates when they are input.

For example, my coordinates are: 2, 3; Your coordinates are 4, 6.

Then define a method:

Public double get distance (double x1,double y 1, double x2, double y2){

Double a = math. ABS (x1-x2); //Absolute value

double b = math . ABS(y 1-y2); //Absolute value

Return to Math.hypot(a, b); //Returns the open root of the sum of squares.

}