sqlçwhereæ¡ä»¶å¤æå¼æ¯å¦ä¸ºnullï¼å¯ä»¥ç´æ¥ä¸NULLè¿è¡æ¯è¾ã
ä¾ï¼
select * from a where e=null;--æ£ç´¢è¡¨aä¸åe为NULLçæ°æ®æ£ç´¢ç¯å¢åæ°æ®åºç®¡çç³»ç»çå·®å¼ï¼é¨åç¯å¢ä¸æ¯æNULLå¼çç´æ¥æ¯è¾ï¼éè¦ä½¿ç¨is nullåis not nulllæ¥å¤æ空å¼NULLï¼ä¸ä¾èæ¬ä¿®æ¹ä¸ºï¼
select a,e from a where e is null;å¦å¤æäºæ°æ®åºï¼NULLå¼æ£ç´¢ç»æå空å符ââæ¯ä¸æ ·çï¼ä¸ºäºåºå«ï¼å¯ä»¥ä½¿ç¨å½æ°æ¥æ´æ¹NULLçæ¾ç¤ºã
ä¾ï¼MS SQL serverä¸çisnullå½æ°ï¼
ä¸ãISNULLè¯æ³æ ¼å¼
ISNULL ( check_expression , replacement_value )
äºãåæ°ç®ä»
check_expressionï¼å°è¢«æ£æ¥æ¯å¦ä¸º NULLç表达å¼ï¼check_expressionå¯ä»¥æ¯ä»»ä½ç±»åçã
replacement_valueï¼å¨ check_expression 为 NULLæ¶å°è¿åç表达å¼ï¼replacement_value å¿ é¡»ä¸ check_expresssion å ·æç¸åçç±»åã
ä¸ãè¿åå¼
è¿åä¸ check_expression ç¸åçç±»åãå¦æ check_expression ä¸ä¸º NULLï¼é£ä¹è¿å该表达å¼çå¼ï¼å¦åè¿å replacement_valueã
å®ä¾ï¼