I consider myself quite good with SQL but I am just stumped on how to even begin to perform this type of search.
It seems like quite a simple scenario - I have a MariaDB database already populated with several records with their location point stored in a POINT data field ("POINT NOT NULL"). I then want to query the database for all entities that are within a given lat/lng. For example, the latitude and longitude for New York City is 40.730610 and -73.935242.
I assume I should be using ST_within()
but I have no idea how I would create the query... in that example, it uses ST_GEOMFROMTEXT('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))')
but I have no idea as to how I would construct the POLYGON or if that is even the solution I am looking for.
If anyone can help or point in the direction of a resource explaining it, I would be very grateful.