Given table, would you please us how to set up the unique constraint so that first_name and last_name are not allowed to type the same field?
CREATE TABLE app_user (
id serial PRIMARY KEY,
first_name VARCHAR (50),
last_name VARCHAR (50),
email VARCHAR (50) UNIQUE
);
CREATE UNIQUE INDEX user_firstname_last_name_id ON app_test.app_user(first_name text_ops,last_name text_ops);
I have created unique constraint including (first_name, last_name) but to no avail.
If first_name is 'Chan' , last_name is 'Mandy' , the database triggers allows this record to be updated
If first_name is 'Chan' , last_name is 'Chan' , the database triggers does not allow this record to be updated
As for insert first time, the constraint check can be ignored