Share on Google+Share on Google+

MySQL Blank Field

Advertisement
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   |
+----------+---------+---------------------+--------+

Advertisements

Posted on: December 9, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.