We know that it is best at the database level to ensure uniqueness, but the special cases to ensure that can trigger or something?
CodePudding user response:
The trigger can be checked,CodePudding user response:
With the only index not lineCodePudding user response:
You can use a trigger to realize,Also can have a try with a unique index, but when there is a unique problems, is two columns, but this any column in the two columns, can is empty, also can only, so as to limit the 2 not null
CodePudding user response:
The trigger can be solved, but applications will still be some trouble, because need to deal with update failedAre you feeling this need is quite strange, don't know whether the application is a special design of time want to slanting
CodePudding user response:
Mysql table has two fields a, b, when a=1, b=1, the record is the only-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- what is a=1, b=1, the record is the only? Is don't need to make sure that the only other values?
CodePudding user response: