Manhattan distance in sql
Cool math train games
distance: 2887.2600 km Maxima dms(d, m, s) := (d + m/60 + s/3600)*%pi/180$ great_circle_distance(lat1, long1, lat2, long2) := 12742*asin(sqrt(sin((lat2 - lat1)/2)^2 + cos(lat1)*cos(lat2)*sin((long2 - long1)/2)^2))$ /* Coordinates are found here: http://www.airport-data.com/airport/BNA/ http://www.airport-data.com/airport/LAX/ */
Microsoft SQL Server 2008 introduced Spatial Data to SQL developers. Here is a t-sql spatial sample which is calculating distance between two points on earth surface. Since we are dealing with points on earth, then we are required to work with geography data types.