I have a table:
I need make UNIQUE NAME if CITY = NEW.city
Blue - success. Row inserted...
Red - failed, cecause John with city = 1
exists.
I have a table:
I need make UNIQUE NAME if CITY = NEW.city
Blue - success. Row inserted...
Red - failed, cecause John with city = 1
exists.
Add a unique key on NAME and CITY
ALTER TABLE `table_name`
ADD UNIQUE `unique_name_city` ( `NAME`, `CITY` );