Ⅰ 高手救急啊!!!如何判断数据库(表)中的内容为空(写出一个语句)
/*
* 判断表_command中是否存有命令
*/
@Override
public boolean ifExistsCommand() {
String query_sql = "select Count(*) from _command ; ";
Connection conn = DB.createConn();
PreparedStatement ps = DB.prepare(conn, query_sql);
ResultSet rs = null;
try {
rs = ps.executeQuery(query_sql);
} catch (SQLException e) {
e.printStackTrace();
}
int rows = 0;
if(null!=rs)
{
try {
while(rs.next()){
rows = rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
DB.close(ps);
DB.close(conn);
if (rows > 0) {
return true;//当查询的结果不为空时返回true
} else {
return false;
}
}
Ⅱ 怎么判断数据库的某个字段值为空
where 字段 is null 是判断为null的
where 字段=''是判断为空