having子句

在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用
查一张表中某个字段中的数据相同的记录:

select   字段值,count(*)   from   table   group   by   字段值   having   count(*)> 1
 
 
alter table 表名 add constraint cpncode_unique unique (字段)
原文地址:https://www.cnblogs.com/jameshappy/p/2013625.html