sqlÖÐis nullµÄÓ÷¨
is null ÊÇ sql ÖÐÒ»¸ö¼ì²é×ֶλò±í´ïʽÊÇ·ñΪ null ÖµµÄ²Ù×÷·û£¬Ó﷨Ϊ¡°×ֶΠis null¡±»ò¡°±í´ïʽ is null¡±¡£Ëü³£ÓÃÓÚ¼ì²é×Ö¶ÎÊÇ·ñΪ null£¬½« null ÖµÓëÆäËûÖµ½ÏÁ¿£¬»ò´ÓЧ¹û¼¯ÖÐɨ³ý¾ßÓÐ null ÖµµÄÐС£
SQL ÖÐ IS NULL µÄÓ÷¨
ʲôÊÇ IS NULL£¿
IS NULL ÊÇÒ»¸ö SQL ²Ù×÷·û£¬ÓÃÓÚ¼ì²é×ֶλò±í´ïʽÊÇ·ñΪ NULL Öµ¡£NULL ÖµÌåÏÖ×Ö¶ÎÖÐûÓÐÖµ»òֵδ֪¡£
Óï·¨
×ֶΠIS NULL
±í´ïʽ IS NULL
ºÎʱʹÓà IS NULL£¿
IS NULL ²Ù×÷·ûͨ³£ÓÃÓÚÒÔÏÂÇéÐΣº
¼ì²é×Ö¶ÎÊÇ·ñΪ NULL£¬ÒÔÈ·¶¨Ä³Ð©Ìõ¼þÊÇ·ñ½¨Éè¡£
½« NULL ÖµÓëÆäËûÖµ¾ÙÐнÏÁ¿¡£
´ÓЧ¹û¼¯ÖÐɨ³ý¾ßÓÐ NULL ÖµµÄÐС£
Àý×Ó
¼ì²é×Ö¶ÎÊÇ·ñΪ NULL£º
SELECT * FROM table_name WHERE field_name IS NULL;
µÇ¼ºó¸´ÖÆ
¸ÃÅÌÎʽ«·µ»Ø table_name ±íÖÐËùÓÐ field_name Ϊ NULL µÄÐС£
½« NULL ÖµÓëÆäËûÖµ¾ÙÐнÏÁ¿£º
SELECT * FROM table_name WHERE field_name = 'John' OR field_name IS NULL;
µÇ¼ºó¸´ÖÆ
¸ÃÅÌÎʽ«·µ»Ø table_name ±íÖÐËùÓÐ field_name Ϊ ‘John’ »ò NULL µÄÐС£
´ÓЧ¹û¼¯ÖÐɨ³ý¾ßÓÐ NULL ÖµµÄÐУº
SELECT * FROM table_name WHERE field_name IS NOT NULL;
µÇ¼ºó¸´ÖÆ
¸ÃÅÌÎʽ«·µ»Ø table_name ±íÖÐËùÓÐ field_name ²»Îª NULL µÄÐС£
ÒÔÉϾÍÊÇsqlÖÐis nullµÄÓ÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡