title: Calculate distance between two points directly in SQLite
body: <p>In my web/MySQL application I have something like this to get distance between two points:</p>
  
  <pre><code>6371 * acos(cos(radians(-19.83996)) * cos(radians(lat)) * cos(radians(-43.94910) - radians(lng)) + sin(radians(-19.83996)) * sin(radians(lat)))
  </code></pre>
  
  <p>But I tested in SQLite and these mathematical functions (acos, cos, radians, sin) do not exist. Is there something equivalent for me to calculate the distance directly in the database?</p>
  
  <p>However, I have an iPhone application that uses <a href="http://www.thismuchiknow.co.uk/?p=71" rel="noreferrer">this method</a> to calculate. Works perfectly, but now I need to perform this same search in the database in an Android application.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have 9000 points to calculate distance and obtain the 5 nearby locations of a given point.</p>