Thread: CREATE table1 FROM table2
Hi, How I create table1 from other table2 . "cp table1 table2" Thanks. -- Rado Petrik <r.p@szm.sk>
Hi, On 17 Jun 2003, Rado Petrik wrote: > How I create table1 from other table2 . CREATE TABLE table1 AS SELECT * FROM table2; will work. Regards, -- Devrim GUNDUZ devrim@gunduz.org devrim.gunduz@linux.org.tr http://www.tdmsoft.com http://www.gunduz.org
On 17 Jun 2003, Rado Petrik wrote: > Hi, > > How I create table1 from other table2 . > > "cp table1 table2" create table table2 as select * from table1; > > Thanks. > > -- ================================================================== Achilleus Mantzios S/W Engineer IT dept Dynacom Tankers Mngmt Nikis 4, Glyfada Athens 16610 Greece tel: +30-210-8981112 fax: +30-210-8981877 email: achill at matrix dot gatewaynet dot com mantzios at softlab dot ece dot ntua dot gr
Hi, Documentation says: CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name [ (column_name [, ...] ) ] AS query example : create table table1 as select * from table2; > -----Message d'origine----- > De : pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org]De la part de Rado Petrik > Envoyé : mardi 17 juin 2003 17:21 > À : pgsql-sql@postgresql.org > Objet : [SQL] CREATE table1 FROM table2 > > > Hi, > > How I create table1 from other table2 . > > "cp table1 table2" > > Thanks. > > -- > Rado Petrik <r.p@szm.sk> > > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend
Dnia 2003-06-17 17:20, Użytkownik Rado Petrik napisał: > Hi, > > How I create table1 from other table2 . > > "cp table1 table2" create table2 as select * from table1; It is described in Postgresql documentation SQL Commands -> "create table as" Regards, Tomasz Myrta
Hi, Le Mardi 17 Juin 2003 20:46, Achilleus Mantzios a écrit : > On 17 Jun 2003, Rado Petrik wrote: > > How I create table1 from other table2 . > > > > "cp table1 table2" > > create table table2 as select * from table1; > Another way would be: select * into table2 from table1; (See http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-selectinto.html). -- Guillaume <!-- http://absfr.tuxfamily.org/ -->.
Hello! many people posted their answer to this simple question. however, neither CREATE TABLE AS nor SELECT INTO do not take care about keys and triggers, etc. The commands above only copy the structure of the table, and the data. Are there any workarounds fr copying the table as a whole object? thanks, Mila > Hi, > On 17 Jun 2003, Rado Petrik wrote: >> How I create table1 from other table2 . > CREATE TABLE table1 AS SELECT * FROM table2; > will work. > Regards,
On Mon, 23 Jun 2003, L.V.Boldareva wrote: > Hello! > > many people posted their answer to this simple question. however, > neither > CREATE TABLE AS > nor > SELECT INTO > > do not take care about keys and triggers, etc. > > The commands above only copy the structure of the table, and the data. > Are there any workarounds fr copying the table as a whole object? You probably want to use pg_dump dbname -t tablename and edit the file thus created by hand to create a new table etc...