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

Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie : writing an efficient query

Re: newbie : writing an efficient query

From: <dn.perl_at_gmail.com>
Date: 4 Aug 2006 16:36:01 -0700
Message-ID: <1154734561.546838.7930@p79g2000cwp.googlegroups.com>

>
> select distinct(a1, a2) from t1 ... does not work.
> How do I write that query?
>

Jeez, I tried out the query without parantheses, and it worked!! This parantheses thing is a bit confusing. create table t1(a1 number, a2 number)
create table t2(a1 number, a2 number)

insert into t2 select (a1, a2) from t1 : does not work. Why? Does (a1, a2) return only one value (prob a1), when the insert stmt expects 2 values?

And why does 'primary key' construct require parantheses around the field even when the key is on just one field?  create table t1(aa number, primary key aa) : does not work.

On second thought the reason is not difficult to figure out but sometimes it does get confusing as to why a simple command is not working. Particularly the syntax requiring absence of parantheses in : select distinct(aa, bb) from t1 is quite confusing. Received on Fri Aug 04 2006 - 18:36:01 CDT

Original text of this message

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