I have a PostgreSQL example table where at most one row that is not of type ‘c’ should be allowed.
I would appreciate any help creating a constraint that will enforce this.
CREATE TABLE example
(
example_id serial PRIMARY KEY,
example_state CHAR(1) NOT NULL
);
ALTER TABLE example ADD CONSTRAINT
example_constraint
CHECK (example_state = 'a' OR example_state = 'b' OR example_state = 'c');