Page 1 of 1

Unique columns

Posted: Tue Oct 04, 2005 7:59 am
by taldos
Quick question regarding 'unique' in mysql.

By Declaring a column unique, does this translate to mean that no given data can ever be duplicated even if that data is removed.

The reason I ask is because I was looking to mysql to make sure an email column was never duplicated (laziness on my part). However after a couple hours of error messages, I have come to the previous tentative conclusion.

if I enter 'noname@hello.com' into an column labeled unique. I later decide to delete this row and enter the name again. Given that the column is unique, should this work or not. If not Guess will have to do a manual verification.

Thx. :wink:

Posted: Tue Oct 04, 2005 8:12 am
by feyd
why not test it?

From what I remember, the data in the column is unique within the given instance of time the record was added. So a deleted record will not affect the creation of a new record.

Posted: Tue Oct 04, 2005 8:51 am
by taldos
I tried and failed which is the reason I thought I'd ask here. Probably an error somewhere else then.

thx. :)