ST_Distance(g1,g2)

Returns the distance between g1 and g2.

As of MySQL 5.7.5, this function processes geometry collections by
returning the shortest distance among all combinations of the
components of the two geometry arguments. If either argument is an
empty geometry collection, the return value is NULL.

As of MySQL 5.7.6, if an intermediate or final result produces NaN or a
negative number, this function produces a ER_GIS_INVALID_DATA error.

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

