210k views
2 votes
Which of the following statements would dump ONLY the table customer from the mydatabase database to backup.sql?

O pg_dump-t customer mydatabase > backup sql
O pg_dump -t customer > backup sql
O pg_dump mydatabase customer > backup sql
O pg_dump -a customer mydatabase > backup sql

1 Answer

5 votes

Final answer:

The correct command to dump only the customer table from the mydatabase to backup.sql is 'pg_dump -t customer mydatabase > backup.sql'. This uses the pg_dump utility with the -t option for a specific table.

Step-by-step explanation:

The statement which would dump ONLY the table customer from the mydatabase database to backup.sql is:
pg_dump -t customer mydatabase > backup.sql

This command uses the pg_dump utility, which is part of the PostgreSQL database system, to extract a PostgreSQL database into a script file. The -t option specifies a single table to dump, in this case, the customer table.

The database name, mydatabase, follows the table name to specify from which database the table should be dumped. Finally, the output is redirected to a file named backup.sql using the '>' operator.

User CEH
by
8.6k points