pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcopying/moving from one table to another
2+ messages / 2 participants
[nested] [flat]
* copying/moving from one table to another
@ 2000-09-27 18:24 Joachim Trinkwitz <jtr@uni-bonn.de>
0 siblings, 1 reply; 2+ messages in thread
From: Joachim Trinkwitz @ 2000-09-27 18:24 UTC (permalink / raw)
To: pgsql-sql
Hi all,
is there a handy way to copy or (preferrably) move a whole record
from one table to another, equally structured table in the same DB?
Background: I have some tables which hold information concerning our
staff, where people quite so often come and go, because their
employment contract is limited to a year or two. When deleting a
person in the DB, I don't want to lose this information completely,
but I want to save it in a backup table.
I suppose this is a newbie question, maybe I am stirring me blind
somewhere ...
Greetings and thanks,
jaochim
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: copying/moving from one table to another
@ 2000-09-27 19:55 Jie Liang <jliang@ipinc.com>
parent: Joachim Trinkwitz <jtr@uni-bonn.de>
0 siblings, 0 replies; 2+ messages in thread
From: Jie Liang @ 2000-09-27 19:55 UTC (permalink / raw)
To: Joachim Trinkwitz <jtr@uni-bonn.de>; +Cc: pgsql-sql
Hi, there,
I do not quite sure is this what you want?
1. if newtable(one you want save) does not exist:
select * into newtable from oldtable;
or
create table newtable as select * from oldtable;
2. if newtable existed, you append some record into it:
insert into newtable select * from oldtable where clause;
Joachim Trinkwitz wrote:
> Hi all,
>
> is there a handy way to copy or (preferrably) move a whole record
> from one table to another, equally structured table in the same DB?
>
> Background: I have some tables which hold information concerning our
> staff, where people quite so often come and go, because their
> employment contract is limited to a year or two. When deleting a
> person in the DB, I don't want to lose this information completely,
> but I want to save it in a backup table.
>
> I suppose this is a newbie question, maybe I am stirring me blind
> somewhere ...
>
> Greetings and thanks,
> jaochim
--
Jie LIANG
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.ipinc.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-09-27 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-27 18:24 copying/moving from one table to another Joachim Trinkwitz <jtr@uni-bonn.de>
2000-09-27 19:55 ` Jie Liang <jliang@ipinc.com>
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