Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: need sql query to check if a column is unique
<samir.vds_at_googlemail.com> wrote
> Hey guys,
>
> I've an table with a column, let's call it employee_id. Do you know an
> sql statement, which can check employee_id, if it has duplicate entries ?
> regards Samir
Hmmm.. looks like homewerk Samir - if you google "duplicate oracle" you'll find it everywhere ;-)
select employee_id.
from table
group by employee_id.
having count(1) >= 2 ;
Cheers, Roelof Schierbeek; DBA Received on Wed Feb 28 2007 - 04:59:51 CST
![]() |
![]() |