I have a MySQL
table named stars
and one of its fields is id_num
with default value NULL
. I want to select all the records where id_num
is not NULL
through a PreparedStatement
in java.
Right now I am trying this :
private final String idStarsSQL = "select * from `stars` where id_num is not ?";
...
preparedStatement = (PreparedStatement) connection.prepareStatement(idStarsSQL);
preparedStatement.setString(1, NULL);
set = preparedStatement.executeQuery();
but it is not working.