Checking for an empty field with MySQL

前端 未结 7 531
有刺的猬
有刺的猬 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:05

    An empty field can be either an empty string or a NULL.

    To handle both, use:

    email > ''
    

    which can benefit from the range access if you have lots of empty email record (both types) in your table.

提交回复
热议问题