Reputation: 2363
Here is my code to delete my first row.
But not effected!
mysql> select * from myt;
+--------+--------------+------+---------+
| Fname | Lname | age | phone |
+--------+--------------+------+---------+
| NULL | Jackson | NULL | NULL |
| stive | NULL | NULL | NULL |
| ghbfgf | rtrgf | 22 | 111 |
| zxas | zxa | 30 | 6547812 |
| wewew | uytree | 22 | 658478 |
+--------+--------------+------+---------+
5 rows in set (0.00 sec)
mysql> delete from myt
-> Where Fname = "NULL";
Query OK, 0 rows affected (0.00 sec)
Thanks!
Upvotes: 1
Views: 91
Reputation: 4268
NULL is not a value in RDBMS; it is a marker for a missing value. When you are using "NULL" it denotes a string value. You can simply use "IS NULL". Hope this helps.
Upvotes: 1
Reputation: 1131
NULL is not a value.
NULL means nothing is present.
So usage of FNAME = "NULL" is wrong.
delete from myt Where Fname IS NULL;
Upvotes: 3
Reputation: 263683
use IS NULL
.
You cannot use arithmetic comparison operators such as =
, <
, or <>
to test for NULL
.
DELETE FROM myt WHERE Fname IS NULL
Upvotes: 9