Home > Database > Mysql Tutorial > body text

How to query fields that are not empty in mysql

WBOY
Release: 2022-05-12 15:41:14
Original
14810 people have browsed it

Mysql query field is not empty method: 1. Use the "select * from table_name where id "";" statement to query; 2. Use "select * from table_name where id != "" ;" statement query.

How to query fields that are not empty in mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to query fields that are not empty in mysql

1. Query that the fields are not empty

select * from table where id <> "";
select * from table where id != "";
Copy after login

How to query fields that are not empty in mysql

How to query fields that are not empty in mysql

# #2. The query is empty

select * from table where id ="";
select * from table where isNull(id);
Copy after login
If the field is of type char or varchar, it is OK to use id=""; if the field is of type int, it is better to use isNull.

How to query fields that are not empty in mysql

Recommended learning:

mysql video tutorial

The above is the detailed content of How to query fields that are not empty in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!