SQL and Meshes

Given a mesh type object somewhere in 3D space (drawn in Blender) and a SQL database consisting of point data of the form (X,Y,Z,attributes) does anyone have any code or ideas as to how one could obtain from SQL the information of all points which fall inside the Mesh ?