Is it somehow possible to do a select for empty strings and NULL values in MySQL without using or?
This:
select * from table where col IN (null, "");
doesn’t work, it ignores the null (or possibly matches it with the string ‘null’).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note, however, than
ORquery will be much more efficient if the column is indexed:This will use
ref_or_nullaccess path on the index.If you need to select from a list of values along with
NULLs, just put all not-null values into the list and add a singleOR IS NULLcondition:This will use an index on
colas well.