ST_NumInteriorRing(poly), ST_NumInteriorRings(poly)

Returns the number of interior rings in the Polygon value poly. If the
argument is NULL or an empty geometry, the return value is NULL.

URL: https://dev.mysql.com/doc/refman/5.7/en/gis-polygon-property-functions.html

