title: How to get id from sqlite Android
body: <p>I have a problems, with get an id of user. I can get name, email, created_at columns, but i cannot get id. Help please.</p>
  
  <pre><code>public SQLiteHandler(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  // Creating Tables
  @Override
  public void onCreate(SQLiteDatabase db) {
      String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_USER + "("
              + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
              + KEY_EMAIL +  " TEXT,"
              + KEY_CREATED_AT + " TEXT" + ")";
      db.execSQL(CREATE_LOGIN_TABLE);
  
      Log.d(TAG, "Database tables created");
  }
  
  // Upgrading database
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      // Drop older table if existed
      db.execSQL("DROP TABLE IF EXISTS " + TABLE_USER);
  
      // Create tables again
      onCreate(db);
  }
  
  /**
   * Storing user details in database
   * */
  public void addUser(String name, String email,  String created_at) {
      SQLiteDatabase db = this.getWritableDatabase();
  
      ContentValues values = new ContentValues();
      values.put(KEY_NAME, name); // Name
      values.put(KEY_EMAIL, email); // Email
      values.put(KEY_CREATED_AT, created_at); // Created At
  
      // Inserting Row
      long id = db.insert(TABLE_USER, null, values);
      db.close(); // Closing database connection
  
      Log.d(TAG, "New user inserted into sqlite: " + id);
  }
  
  /**
   * Getting user data from database
   * */
  public HashMap&lt;String, String&gt; getUserDetails() {
      HashMap&lt;String, String&gt; user = new HashMap&lt;String, String&gt;();
      String selectQuery = "SELECT * FROM " + TABLE_USER;
  
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
      // Move to first row
      cursor.moveToFirst();
      if (cursor.getCount() &gt; 0) {
          user.put("name", cursor.getString(1));
          user.put("email", cursor.getString(2));
          user.put("created_at", cursor.getString(3));
      }
      cursor.close();
      db.close();
      // return user
      Log.d(TAG, "Fetching user from Sqlite: " + user.toString());
  
      return user;
  }
  
  /**
   * Re crate database Delete all tables and create them again
   * */
  public void deleteUsers() {
      SQLiteDatabase db = this.getWritableDatabase();
      // Delete All Rows
      db.delete(TABLE_USER, null, null);
      db.close();
  
      Log.d(TAG, "Deleted all user info from sqlite");
  }`
  </code></pre>
  
  <p>Result of fetch: </p>
  
  <blockquote>
    <p>D/SQLiteHandler: Fetching user from Sqlite: {name=admin,
    created_at=2020-05-06 22:04:39, email=admin@gmail.com}</p>
  </blockquote>