code: public static boolean queryHasResult(Statement stmt, String sql) {
      try {
        ResultSet rs = stmt.executeQuery(sql);
        try {
          return rs.next();
        } finally {
          rs.close();
        }
      } catch (SQLException e) {
        throw new DukeException(e);
      }
    }
docs: Returns true if the query result has at least one row.