pg_dump --table=users mydb > users.sql

Category: Databases & SQL

pg_dump --table=users mydb > users.sql

Back up a single table

Dumps only the users table (schema plus data) as plain SQL; repeat --table for several tables. Combine with --schema-only or --data-only to split structure from rows. Related: pg_dump mydb for the whole database.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.