NULL মান পরীক্ষা করতে IS NULL ব্যবহার করুন।
টেবিল তৈরি করা
mysql> create table DemoTable -> ( -> Number1 int, -> Number2 int -> ); Query OK, 0 rows affected (0.62 sec)
রেকর্ড ইনসার্ট করা
mysql> insert into DemoTable values(1,NULL); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable values(NULL,NULL); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(3,NULL); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(NULL,90); Query OK, 1 row affected (0.11 sec)
সকল রেকর্ড প্রদর্শন
mysql> select *from DemoTable;
আউটপুট
+---------+---------+ | Number1 | Number2 | +---------+---------+ | 1 | NULL | | NULL | NULL | | 3 | NULL | | NULL | 90 | +---------+---------+ 4 rows in set (0.00 sec)
দুই কলামের NULL মান গণনা করে একই SELECT-এ দেখানোর কোয়েরি
mysql> select -> (select count(*) from DemoTable where Number1 is null) as FirstColumnNullValue, -> (select count(*) from DemoTable where Number2 is null) as SecondColumnNullValue -> ;
আউটপুট
+----------------------+-----------------------+ | FirstColumnNullValue | SecondColumnNullValue | +----------------------+-----------------------+ | 2 | 3 | +----------------------+-----------------------+ 1 row in set (0.00 sec)