Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Unique over 2 columns

ecxod's profile image ecxod posted 2 weeks ago in General Permalink

I am not sure but as far as I know a unique over 2 columns should accept a distinct entry only once in both columns.


So basically in my example if I add a email in column eml, I should not be able to add the same email again in column emlreq.

If this is correct? If yes we have a bug.

ansgar's profile image ansgar posted 2 weeks ago Permalink

No, in a unique key, the combination of its values is unique over the whole table. So both columns can happily have the same values, as long as there is no other row containing the same combination:

eml emlreq
abc abc valid
def abc valid
def def valid
def def invalid duplicate to prior row!

Please login to leave a reply, or register at first.