April 25th 2013 in MySQL
Today I discovered that you can avoid:
SELECT * FROM table_name WHERE value IS NOT NULL AND value != '';
And instead use:
SELECT * FROM table_name WHERE value > '';
This checks that the value is both not null, and not an empty string in one go. Okay, it’s not as readable, but it’s good for quick queries.