title: Delete records from sqlite database
body: <p>I am new to ios Development. Can you help me to delete a record from a table. Database and query seems fine. But I dont know why its not deleteing the records. I Can see the nslog "profile deleted" in my console. Thanks in advance.</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      self.str_databasePath = [documentsDirectory stringByAppendingPathComponent:@"MY_database.sqlite"];
  
      sqlite3 *database = nil;
  
      if (sqlite3_open([self.str_databasePath UTF8String], &amp;database) == SQLITE_OK)
      {
          NSLog(@"database opened : %@", profileType);
          const char* sqlStatement;
          if([profilerType isEqualToString:@"personal"]){
              sqlStatement = "DELETE FROM TABLE1 where profile_type = 'OWN_PERSONAL'";
          }else if([profilerType isEqualToString:@"corporate"]){
              sqlStatement = "DELETE FROM TABLE2 where profile_type = 'BANK_PROFILE'";  
          }
          sqlite3_stmt *statement;
  
          if(sqlite3_prepare_v2(database, sqlStatement, -1, &amp;statement, NULL) == SQLITE_OK)
          {
              NSLog(@"profile deleted ");
              return YES;
          }else{
  
              NSAssert1(0,@"Error: Failed to prepare statement with message %s '.", sqlite3_errmsg(database));
          }
  
  
          // Finalize and close database.
          sqlite3_finalize(statement);
          sqlite3_close(database);
      }
       return NO;
  </code></pre>