Dump a subset of a table

I want to reset a subset of my postgres database table. Is there a way to reset a SELECT statement without creating a view?

I need to copy part of a table to another postgres database.

+5
source share
1 answer

Use COPY to unload it directly to disk.

Example (from a thin tutorial) using SELECT:

COPY 
(SELECT * FROM country WHERE country_name LIKE 'A%') 
TO '/usr1/proj/bray/sql/a_list_countries.copy';
+11
source

All Articles