নন-নাল মান খুঁজে বের করে দেখানোর জন্য IS NOT NULL ব্যবহার করা হয়। প্রথমে একটি টেবিল তৈরি করি:
mysql> create table DemoTable1458 (
-> StudentName varchar(20),
-> StudentScore int
-> );
Query OK, 0 rows affected (0.52 sec)
রেকর্ড ইনসার্ট করি (NULL সহ):
mysql> insert into DemoTable1458 values('Chris Brown',56);
Query OK, 1 row affected (0.14 sec)
mysql> insert into DemoTable1458 values('David Miller',NULL);
Query OK, 1 row affected (0.17 sec)
mysql> insert into DemoTable1458 values('John Doe',78);
Query OK, 1 row affected (0.08 sec)
mysql> insert into DemoTable1458 values('Adam Smith',NULL);
Query OK, 1 row affected (0.12 sec)
সব রেকর্ড দেখি:
mysql> select * from DemoTable1458;
আউটপুট:
+--------------+--------------+ | StudentName | StudentScore | +--------------+--------------+ | Chris Brown | 56 | | David Miller | NULL | | John Doe | 78 | | Adam Smith | NULL | +--------------+--------------+ 4 rows in set (0.00 sec)
NULL মান উপেক্ষা করার কোয়েরি:
mysql> select StudentName,StudentScore from DemoTable1458
-> where StudentScore IS NOT NULL;
আউটপুট:
+-------------+--------------+ | StudentName | StudentScore | +-------------+--------------+ | Chris Brown | 56 | | John Doe | 78 | +-------------+--------------+ 2 rows in set (0.00 sec)
সতর্কতা: WHERE StudentScore != NULL বা WHERE StudentScore <> NULL কাজ করে না। অবশ্যই IS NOT NULL ব্যবহার করতে হয়।