Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: need sql query to check if a column is unique

Re: need sql query to check if a column is unique

From: <magicwand_at_gmx.at>
Date: 28 Feb 2007 02:36:50 -0800
Message-ID: <1172659010.449353.222360@j27g2000cwj.googlegroups.com>


On 28 Feb., 11:08, "samir...._at_googlemail.com" <samir...._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

select employee_id, count(*) from <table> group by employee_id having count(*) > 1;

How about a UNIQUE constraint ?

regards Received on Wed Feb 28 2007 - 04:36:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US