pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
copy table
3+ messages / 3 participants
[nested] [flat]

* copy table
@ 2005-10-14 08:44  Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
  0 siblings, 2 replies; 3+ messages in thread

From: Shavonne Marietta Wijesinghe @ 2005-10-14 08:44 UTC (permalink / raw)
  To: pgsql-sql

Hello

How can i copy a table from one schema to another..

Example..

* I have a database "mydatabase"
* then i have 2 schemas "myschema1" and "myschema2"
* in "myschema1" i have inserted a new line and i want to copy that to "myschema2" so they both will be same.. 

How can i do it with SQL ?? 

I use pgadmin 3 to make my database in postgresql

thank u

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy table
@ 2005-10-14 09:39  A. Kretschmer <andreas.kretschmer@schollglas.com>
  parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
  1 sibling, 0 replies; 3+ messages in thread

From: A. Kretschmer @ 2005-10-14 09:39 UTC (permalink / raw)
  To: pgsql-sql

am  14.10.2005, um 10:44:13 +0200 mailte Shavonne Marietta Wijesinghe folgendes:
> Hello
> 
> How can i copy a table from one schema to another..

create table as select * from table

> 
> Example..

Yeah!

test=# create schema foo;
CREATE SCHEMA
test=# create schema bar;
CREATE SCHEMA
test=# create table foo.test (id int);
CREATE TABLE
test=# insert into foo.test values (1);
INSERT 3381544 1
test=# create table bar.test as select * from foo.test;
SELECT
test=# select * from foo.test;
 id
----
  1
(1 row)

test=# select * from bar.test;
 id
----
  1
(1 row)


> I use pgadmin 3 to make my database in postgresql

You shold better use psql to learn sql.


Regards, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: copy table
@ 2005-10-14 14:48  Muralidharan Ramakrishnan <contact2muraliin@yahoo.co.in>
  parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
  1 sibling, 0 replies; 3+ messages in thread

From: Muralidharan Ramakrishnan @ 2005-10-14 14:48 UTC (permalink / raw)
  To: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>; pgsql-sql

INSERT INTO MYSCHEMA2.TABLENAME
     SELECT * FROM MYSCHEMA1.TABLENAME WHERE < CONDITION >

Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it> wrote:
Hello
 
How can i copy a table from one schema to another..
 
Example..
 
* I have a database "mydatabase"
* then i have 2 schemas "myschema1" and "myschema2"
* in "myschema1" i have inserted a new line and i want to copy that to "myschema2" so they both will be same.. 
 
How can i do it with SQL ?? 
 
I use pgadmin 3 to make my database in postgresql
 
thank u


		
---------------------------------
 Yahoo! India Matrimony: Find your partner now.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-10-14 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-14 08:44 copy table Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
2005-10-14 09:39 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2005-10-14 14:48 ` Muralidharan Ramakrishnan <contact2muraliin@yahoo.co.in>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox