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: query performance

Re: query performance

From: steph <stephan0h_at_yahoo.de>
Date: Mon, 22 Oct 2007 03:10:59 -0700
Message-ID: <1193047859.042578.294870@v23g2000prn.googlegroups.com>


On 22 Okt., 04:27, Raan <raan0..._at_gmail.com> wrote:
> Hi All
>
> i have one query
>
> i have information about some people , these people have mulitple
> addresses(2-4) and multiiple phone numbers(3-10).
>
> I have created table like following
>
> people_table
> peopleid , name , age , profession , sex
>
> Address_table
> address_Id,peopleid , address
>
> phone_number_table
>
> phone_number_Id,
> peopleid , phone
>
> The problem is that if i want to know the information about people
> with name "john"
>
> then i have to run many queries
>
> first query is
> select peopleid , name , age from people_table;
>
> second query
> in loop according to the rslt obtained
> select address from Address_table where peopleId = ID_OBTAINED
>
> third query.. again in loop
> select address from phone_number_table where peopleId = ID_OBTAINED
>
> Is there any better for solving my problem. I think my db design or
> way of querying is poor.
>
> thnx
> Raan

SQL allows the joining of tables. This happens in the from clause. See:

select peopleid , name , age
from people_table
inner join Address_table on ...

regards, Received on Mon Oct 22 2007 - 05:10:59 CDT

Original text of this message

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