Creating Table Copy

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Creating Table Copy
Date: 2014-06-16 20:51:13
Message-ID: alpine.LNX.2.11.1406161342100.28452@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table with some NULL values in a date column. I need to make a
copy of that table containing only those rows where the date column is not
null. Reading the CREATE TABLE man page I've tried to create a copy of the
original table from which I could drop rows. While the table creating is
successful, it contains no rows. I do not see an option to include the data
as well as the schema.

The syntax I thought would work is,

# create table benthos (like benthosraw including all);

but it creates an empty table.

Please pass me a clue on copying the data as well as the schema.

While I suspect there's a way to write a SELECT statement for those rows
that are not null and save the results to a different table name, I've not
found the syntax in my postgres and SQL references.

TIA,

Rich

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2014-06-16 20:55:42 Re: Creating Table Copy [RESOLVED]
Previous Message Jeff Janes 2014-06-16 18:49:42 Re: (Relatively) Oversized Checkpoint