I have columns which are a primary key and a plain column on a table. I want to maintain integrity about two columns.
Suppose I have a user table and two datas. I want to have integrity between a id column and a create_user column
CREATE TABLE USER (
id varchar(10) not null,
create_user varchar(10) not null,
PRIMARY KEY (id)
);
insert into USER (id,create_user) values ('system','system');
insert into USER (id,create_user) values ('user01','system');
The result is
| id | create_user |
| -------- | ------------|
| system | system |
| user01 | system |
If I update id(a primary key), It doesn't have integrity.
update USER SET id='master' WHERE id='system';
The result is
| id | create_user |
| -------- | ------------|
| master | system |
| user01 | system |
But I want to this on a table. Is it possible? I don't want additional update queris
| id | create_user |
| -------- | ------------|
| master | master |
| user01 | master |