SQL HAVERSINE function in snowflake for geo-data.

TIP for use: I needed to find our nearest customer for potential customers. A simple solution is offered by SQL function HAVERSINE, which calculates the distance between two geo points.ย 
In the first SELECT, you create an array of known points x unknown. Use the function to calculate the distance. In the Second SELECT, you sort by distances and select the nearest one.ย 
Special thanks to Samuel for help.ย 

Snowflake Documentation.
ย 

4