Home  >  Article  >  Database  >  MySQL小技巧总结_MySQL

MySQL小技巧总结_MySQL

WBOY
WBOYOriginal
2016-06-01 13:11:08925browse
1.MySQL避免相同数据重复插入

若用户注册表有一列是email,避免相同email注册多个账号,那么就设置email为unique,这样就使email是唯一的,不会重复.

当插入的email和原来的一个email相同,则无法插入新的数据.

alter table table_name add unique email


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn