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: sql quiz

Re: sql quiz

From: Fengqing Zhou <zhouf_at_rintintin.Colorado.EDU>
Date: 1998/01/07
Message-ID: <690en7$c0e@peabody.colorado.edu>#1/1

In article <34B25E5C.235C_at_att.com>, Naren Chintala <naren_at_att.com> wrote:
>Hi,
>
>
>SQL> describe t1;
> Name Null? Type
> ------------------------------- -------- ----
> C1 NUMBER
>
>SQL> select c1 from t1;
>
> C1
>----------
> 1
> 4
> 7
> 8
> 9
> 10
>
>Question:
>
>I need to retrieve the missing numbers (2,3,5,6) from t1.
>How can I do this in ONE sql statement?
>I know that this can be done in PL/SQL.
>
>Any ideas?
>Thanks
>Naren

how about
select 1 from dual union all
select 2 from dual union all
select 3 from dual union all
select 4 from dual union all
select 5 from dual union all
select 6 from dual union all
select 7 from dual union all
select 8 from dual union all
select 9 from dual union all
select 10 from dual
minus
select c1 from t1
/ Received on Wed Jan 07 1998 - 00:00:00 CST

Original text of this message

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