code: private static String whereClauseForNot(String fieldName,
                                              String sqlOperator,
                                              String tableName,
                                              String operand) {
          String whereForSubSelect = String.format(Locale.ENGLISH, "\"%s\" %s %s", fieldName, sqlOperator, operand);
          String subSelect = String.format(Locale.ENGLISH, "SELECT _id FROM \"%s\" WHERE %s",
                                           tableName,
                                           whereForSubSelect);
  
          return String.format("_id NOT IN (%s)", subSelect);
      }
docs: WHERE clause representation of $not must be handled by using a
  sub-SELECT statement of the operator which is then applied to
  _id NOT IN (...).  This is because this process is the only
  way that we can ensure that documents that contain arrays are
  handled correctly.
  
  @param fieldName the field to be NOT-ted
  @param sqlOperator the SQL operator used in the sub-SELECT
  @param tableName the chosen table index
  @return the NOT-ted WHERE clause for the fieldName and sqlOperator