For example, you can export only the data of apple database of the user(role) john to backup.sql as shown below. *My answer explains how to export both schema and data:
pg_dump -U john -a apple > backup.sql
Or:
pg_dump -U john --data-only apple > backup.sql
And, you can export only the data of apple database of the user(role) john to backup.sql with only INSERT statement which has column names as shown below:
pg_dump -U john -a --column-inserts apple > backup.sql
And, you can export only the data of apple database of the user(role) john to backup.sql with only INSERT statement which doesn't have column names as shown below:
pg_dump -U john -a --inserts apple > backup.sql
And, you can export only the data of the specific tables person and animal of apple database of the user(role) john to backup.sql with only INSERT statement which has column names as shown below. *Specifying multiple tables are available in one command:
pg_dump -U john -a --column-inserts -t person -t animal apple > backup.sql
Or:
pg_dump -U john -a --column-inserts --table=person --table=animal apple > backup.sql
Or:
pg_dump -U john -a --column-inserts --table person --table animal apple > backup.sql
Lastly for example, you export only the data of the specific tables person and animal of apple database of the user(role) john to backup.sql with only INSERT statement which has column names as shown below:
pg_dump -U john -a --column-inserts -t person -t animal apple > backup.sql
Then, you can import backup.sql to orange database of the user(role) john with psql which must be used to import non-archive files as shown below. *You have to create orange database and the schema otherwise there is error and my answer explains how to create a database and my answer explains how to import schema and data:
psql -U john -f backup.sql orange
And, for example, you export and archive(-Fc) only the data of the specific tables person and animal of apple database of the user(role) john to backup.sql with only INSERT statement which has column names as shown below. *My answer explains how to export and archive a database:
pg_dump -U john -Fc -a --column-inserts -t person -t animal apple > backup.sql
Then, you can import archive backup.sql to orange database of the user(role) john with pg_restore which must be used to import archive files as shown below. *You have to create orange database and the schema otherwise there is error and my answer explains how to create a database and my answer explains how to import archive files:
pg_restore -U john -d orange < backup.sql