📅  最后修改于: 2022-03-11 15:05:31.735000             🧑  作者: Mango
CREATE TRIGGER uinsert BEFORE INSERT ON tbl_challenger
FOR EACH ROW SET NEW.u0 = LEAST(NEW.host,NEW.challenger),
NEW.u1 = GREATEST(NEW.host,NEW.challenger);
#same for update
CREATE UNIQUE INDEX uniqueness ON tbl_challenger(u0,u1);