ST_Distance(g1, g2)

Returns the distance between g1 and g2. If either argument is NULL or
an empty geometry, the return value is NULL.

This function processes geometry collections by returning the shortest
distance among all combinations of the components of the two geometry
arguments.

If an intermediate or final result produces NaN or a negative number,
an ER_GIS_INVALID_DATA
(https://dev.mysql.com/doc/mysql-errors/5.7/en/server-error-reference.h
tml#error_er_gis_invalid_data) error occurs.

URL: https://dev.mysql.com/doc/refman/5.7/en/spatial-relation-functions-object-shapes.html

