How to check for NULL or empty String?

Is there a (shorter) expression we can use to do the following?

... WHERE parent_id = '' OR parent_id IS NULL
and
... WHERE parent_id <> '' OR parent_id IS NOT NULL

Basically empty string and NULL mean both NULL for us ? (historical reasons)

The index definition containing this field we would like to to hit is:
CREATE INDEXidx_variantidsONdatastoreitems(parent_id,object_length(ifmissingornull(variantids, {})))

Is the query somehow problematic with regards to the index definition?

CREATE INDEX ix1 ON default(IFNULL(parent_id,""));
SELECT ...  
FROM default
WHERE  IFNULL(parent_id,"") = "";

If you want missing also use IFMISSINGORNULL()

1 Like