Home Tutorial Php Sql MySQL Blank Field

 
 

MySQL Blank Field
Posted on: December 9, 2010 at 12:00 AM
This example illustrates how to find Blank field by the MySQL Query.

MySQL Blank Field

This example illustrates how to find Blank field by the MySQL Query.

In the table 'example' two t_count fields are blank and we find both field which has some value by query 'select * from example where t_count is not null' and find which field has null value by query 'select * from example where t_count is null'. The output display in the table below.

Query

select * from example;

Output

+----------+---------+---------------------+--------+
| t_author | t_count | modified            | userid |
+----------+---------+---------------------+--------+
| sandeep  | 20      | 0000-00-00 00:00:00 | NULL   |
| suman    | NULL    | 0000-00-00 00:00:00 | NULL   |
| kumar    | NULL    | 0000-00-00 00:00:00 | NULL   |
| mukesh   | 20      | 0000-00-00 00:00:00 | NULL   |
+----------+---------+---------------------+--------+

Query

select * from example where t_count is not null;
Output
+----------+---------+---------------------+--------+
| t_author | t_count | modified            | userid |
+----------+---------+---------------------+--------+
| sandeep  | 20      | 0000-00-00 00:00:00 | NULL   |
| mukesh   | 20      | 0000-00-00 00:00:00 | NULL   |
+----------+---------+---------------------+--------+
Query
select * from example where t_count is null;
+----------+---------+---------------------+--------+
| t_author | t_count | modified            | userid |
+----------+---------+---------------------+--------+
| suman    | NULL    | 0000-00-00 00:00:00 | NULL   |
| kumar    | NULL    | 0000-00-00 00:00:00 | NULL   |
+----------+---------+---------------------+--------+

Related Tags for MySQL Blank Field: