title: how to use rawQuery in android
body: <p>I have a database table with 3 columns: id, name, permission.</p>
  
  <p>It looks like this:</p>
  
  <p>1 Comics fun</p>
  
  <p>2 Communication talk</p>
  
  <p>3 Comics watch</p>
  
  <p>I am trying to get the permission where the name is comics.  I am using the following code in my database class(AppData.java):</p>
  
  <pre><code>private final static String DB_NAME = "safety_app_database"; // the name of our database
  private final static int DB_VERSION = 1; // the version of the database
  
  // the names for our database columns
  private final String TABLE_NAME = "permissions_table";
  private final String ID = "id";
  private final String NAME = "name";
  private final String PERMISSION = "permission";
  </code></pre>
  
  <p>and the method</p>
  
  <pre><code>public Cursor getData(){
          return db.rawQuery("SELECT permission FROM permissions_table WHERE name = 'Comics', null);
      }
  </code></pre>
  
  <p>and I'm calling this in my main class (safety.java).  AppData is referencing AppData.java</p>
  
  <pre><code>appData.getData();
  </code></pre>
  
  <p>Is this the correct way to do it?  I am unsure, and it is giving me an error whenever I try to call the sql query.</p>