Re: SQL statement to copy a result set to create another table

From: "Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: SQL statement to copy a result set to create another table
Date: 2002-11-14 15:27:21
Message-ID: 200211141530.gAEFUnJM008253@artemis.cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 14 Nov 2002 at 11:05, YC Nyon wrote:
> I want to create a new table based on an earlier result set from a SQL
> query.
> For example;
> Query 1:
> Select * from test where id >20
>
> This will give me a result that 10 records found.
> I would like to create a new table and insert these 10 records.

SELECT INTO will do this

> Also, I looking into views. would that be a better choice.

Not if you want create a new table.

> The application
> let users store their data via PHP.
>
> Thanks
> Nyon
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2002-11-14 15:39:35 Re: SQL statement to copy a result set to create another table
Previous Message YC Nyon 2002-11-14 03:05:50 Re: SQL statement to copy a result set to create another table