UNIQUE Column

I am looking for some help in the clarification of the UNIQUE key. For example, say I created a table and appended UNIQUE (email, activation, code) to the end of the CREATE statement. When inserting data, does the unique fields create a combined unique key or are they separate? In other words does an insert look for a row with all three unique fields to be the same or will it be unsuccessful if just one of the fields is a duplicate?

the combination of column values has to be unique

So to accomplish individual UNIQUE, it means that I have to do SELECT queries prior to make sure the values are not there?

you never have to do SELECTs to ensure uniqueness

what is it you want to do?

what was the purpose of declaring a 3-column composite UNIQUE key?

I was trying to understand how they work in concept. If I had a field for email and then a field for a salt key, I would want to make sure the email is UNIQUE and that the salt can only be in the database once as well. I guess if I created the salt with the email among other things, I shouldn’t have to worry about that I suppose and can just have email as UNIQUE.

If the email is a UNIQUE field, does that mean with my coding language I shouldn’t perform a select query, just try to insert the email and then check if the insert query succeeded to know if the email exists already or not?

yes :slight_smile: