Skip to content

How unique field in table in PHPmyadmin?

1 ) ALTER TABLE  `foo` ADD UNIQUE ( `bar` )

or 

2 ) You do not have duplicates -> will apply the key without issues
You do have duplicates -> will give an error message, nothing happened to your data
All is unique, except several rows with NULL in them, unique constraint is still applied, as NULL is not checked when checking for unique values (you can have the entire table have a NULL value in a unique field without any error message).
See also  Python code snippet - How to get frequency of each elements in a list?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.