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 error occurs.

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

