1.不为空
select * from table where id <> "";
select * from table where id != "";
2.为空
select * from table where id ="";
select * from table where isNull(id);
具体情况具体分析,如果字段是char或者varchar类型的,使用id=""可以的;
如果字段是int类型的,使用isNull会好些。
以上就是害怕蜗牛最近收集整理的关于mysql 查询出某个字段的值不为空的语句的全部内容,更多相关mysql内容请搜索靠谱客的其他文章。
发表评论 取消回复