On Mon, 21 Jul 2003, Kathy Zhu wrote:

> How can you have two tables with the same name in one database ??
> How do you differentiate them when you use it in queries ??

In different schemas. For example:

create schema first;
create schema second;

create table first.atable ( id serial primary key, value text );
create table second.atable ( id serial primary key, value text );

insert into first.atable (value) values ('this is in first schema');
insert into second.atable (value) values ('this is in second schema');

select * from second.atable;

select * from atable;
ERROR (possibly)


and then there is the search path:

set search_path to second, first;
select * from atable;
Gives: value == 'this is second schema'


Hope that helps.

-- 
Nigel J. Andrews


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to