I have a simple table on my local server.
mysql> desc table ;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(10) | YES | | NULL | |
| count | int(10) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec
It has just three records in it.
mysql> select * from uday ;
+------+-------+
| id | count |
+------+-------+
| 1 | 1 |
| 2 | 2 |
| 3 | 0 |
| 4 | NULL |
+------+-------+
4 rows in set (0.00 sec)
Now, why is that i am not seeing the fourth column in the below result..?
mysql> select * from uday where count NOT IN (0) ;
mysql> select * from uday where count != 0 ;
+------+-------+
| id | count |
+------+-------+
| 1 | 1 |
| 2 | 2 |
+------+-------+
2 rows in set (0.00 sec)
how about the 4th record…? Its not visible in the result.
NULL is not 0 RIGHT…?
please ignore if it looks pretty foolish as I am not even competitive in coding part.
is shorthand for:
In SQL’s three-valued logic,
col1 <> nullreturnsunknown. Andtrue and true and unknownalso returnsunknown. Sincewhereonly acceptstrue, and notunknown, the row withnullis filtered out of the result set.