Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Skill testing SQL question
How about:
delete from DUPE_TABLE a
where a.rowid > (select min(b.rowid) from DUPE_TABLE b
where b.AA = a.AA and b.BB = a.BB )
argosy22_at_my-deja.com wrote:
> Hello all,
>
> This is a good skill testing question
> that I was asked in an interview.
>
> You have a table, DUPE_TABLE,
> with two fields, AA, and BB.
> No primary key. Dupe data.
> Only 6 rows.
> 2 sets of the same exact 3 rows.
>
> DUPE_TABLE:
> AA BB
> 1 x
> 2 y
> 3 z
> 1 x
> 2 y
> 3 z
>
> You want to delete 3 rows, so that
> you have only one set of 3:
>
> AA BB
> 1 x
> 2 y
> 3 z
>
> To date, I haven't been able to
> figure out the answer.
> Does anyone have any ideas
> how to delete these dupe rows
> with SQL code?
>
> Happy puzzling,
>
> Argosy
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
55 Broadway - 21st Floor
New York, New York 10006
Phone: 800.221.5327 x2136
Fax: 212-825-2245
E-Mail: MWeinstock_at_lds.com
Web: http://www.lds.com
Received on Thu Nov 04 1999 - 15:47:39 CST
![]() |
![]() |