Checking for an empty field with MySQL

前端 未结 7 502
有刺的猬
有刺的猬 2020-12-12 14:58

I\'ve wrote a query to check for users with certain criteria, one being they have an email address.

Our site will allow a user to have or not have an email address.<

7条回答
  •  天命终不由人
    2020-12-12 15:22

    If you want to find all records that are not NULL, and either empty or have any number of spaces, this will work:

    LIKE '%\ '
    

    Make sure that there's a space after the backslash. More info here: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html

提交回复
热议问题