I have a key-value table.
CREATE TABLE keyvalues ( key TEXT NOT NULL, value TEXT ) I want to impose a constraint that if a key has an entry with NULL value, it cannot have any other entries. How do I do that?
To clarify: I want to allow ("key1", "value1"), ("key1", "value2"). But if I have ("key2", NULL), I want to not allow ("key2", "value3").
NOT NULLit can't have aNULLvalue. You are going to show some (pseudo)code explaining what you want to achieve.BEFORE INSERT.