title: Using the WHERE clause in SQLite
body: <p>I have a general question about using WHERE clauses in SQLite. I have worked with SQLite some and know my way around. However, I'm having trouble with WHERE clauses.</p>
  
  <p>I have an Android application in which I'm needing to do a few simple operations with the SQLite WHERE clause. However, despite experimenting with the WHERE clause all day, I've come up empty. I am trying to perform very simple SQLite commands (e.g. <code>SELECT name FROM tablename WHERE _id=2</code> or <code>DELETE FROM tablename WHERE name='somename'</code>). But, every time I use the where clause I either get 0 rows returned (in the case of a SELECT) or have 0 rows deleted.</p>
  
  <p>The table name is correct. The column names are correct. (I haven't had any trouble selecting or inserting as long as I don't specify a WHERE clause.) I made sure that the queries/statements were well formed. I've tried both raw queries/statements as well as the methods (I made sure to use the correct methods for SELECT and DELETE {e.g. <code>rawQuery()</code> or <code>query()</code> for SELECT}) provided from the <code>SQLiteDatabase</code> class in Android, but <strong>nothing</strong> has worked.</p>
  
  <p>All I need is to be able to perform simple queries/statements using the WHERE clause. Does anyone have any insight as to what's happening? </p>
  
  <p><strong>Here's the code to create the table that I'm using:</strong></p>
  
  <pre><code>public static final String TABLE_WORKOUTS = "workouts"
  
  public static final String W_ID = "_id";
  public static final String W_WORKOUT_NAME = "workout_name";
  public static final String W_EXERICSE_NAME = "exercise_name";
  public static final String W_EXERCISE_SETS = "exercise_sets";
  public static final String W_EXERCISE_FIRST_ATTRIBUTE = "first_attribute";
  public static final String W_EXERCISE_SECOND_ATTRIBUTE = "second_attribute";
  public static final String W_EXERCISE_TYPE = "exercise_type";
  
  private static final String createTableWorkouts = "CREATE TABLE " + TABLE_WORKOUTS + " (" + W_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + 
          W_WORKOUT_NAME + " TEXT, " + W_EXERICSE_NAME + " TEXT, " + W_EXERCISE_SETS + " TEXT, " +
          W_EXERCISE_FIRST_ATTRIBUTE + " TEXT, " + W_EXERCISE_SECOND_ATTRIBUTE + " TEXT, " + W_EXERCISE_TYPE + " TEXT);";
  </code></pre>
  
  <p><strong>Example query:</strong>
  <code>String workoutName = "Some Workout"; 
  Cursor cursor = datasource.executeRawQuery("SELECT * FROM " +     WorkoutDatabase.TABLE_WORKOUTS + " WHERE " + WorkoutDatabase.W_EXERICSE_NAME + 
                              "='" + workoutName + "'", null);</code></p>
  
  <p><strong>Example record (_id, workout_name, exercise_name, sets, first_attribute, second_attribute, exercise_type):</strong> 23, Upper Body, Bench Press, 5, 160, 5, Weight</p>