重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
sql中判斷非空不能用等號,因為null在sql中被看作特殊符號,必須使用關鍵字 is和not
創新互聯建站是一家專業提供云溪企業網站建設,專注與成都網站制作、網站設計、H5高端網站建設、小程序制作等業務。10年已為云溪眾多企業、政府機構等服務。創新互聯專業的建站公司優惠進行中。
select * from A where info is not null
問題延展:不為空有2中種,不是空值 is not null 不是空格 ""
比如\x0d\x0ainsert into table a (a1,b1)values("a1",'');\x0d\x0a對于這種情況,因為表里存的是'',其實是沒有內容的,要查詢這個字段,不能直接使用\x0d\x0aselect *\x0d\x0afrom a\x0d\x0awhere b1='';\x0d\x0asql中判斷非空不能用等號,因為null在sql中被看作特殊符號,必須使用關鍵字 is和not\x0d\x0a應該如此使用:\x0d\x0aselect * from A where b1 is null\x0d\x0a或者:\x0d\x0aselect * from A where b1 is not null
select * from 表名 where 字段名 is not null; -- 某字段不為空。
select * from 表名 where 字段名 is null; -- 某字段為空。