📜  phpmyadmin中表中的唯一字段如何 - PHP代码示例

📅  最后修改于: 2022-03-11 14:53:43.240000             🧑  作者: Mango

代码示例1
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).