Master PostgreSQL data import and export processes with this focused set of 30 MCQs. Explore topics like using COPY for bulk data loading, exporting files, importing various formats, and handling data encoding.
WITH clause in a COPY command allow you to do?
COPY ... TO 'file.csv' with FORMAT CSVEXPORT ... TO 'file.csv'SAVE ... TO 'file.csv'DUMP ... TO 'file.csv'WITH HEADER optionHEADER option in the COPY commandINCLUDE COLUMNS clauseCOPY ... FROM commandIMPORT ... INTO commandINSERT ... FROM FILE commandLOAD DATA commandFORCE_NULL option in the COPY command do?
pg_dump tool generate by default?
FORMAT XLSXHere are the answers to the MCQs:
| Qno | Answer |
|---|---|
| 1 | C) COPY |
| 2 | B) The file path must be accessible by the database server |
| 3 | A) DELIMITER |
| 4 | A) HEADER |
| 5 | B) The operation fails completely |
| 6 | B) Define file format and options |
| 7 | C) COPY |
| 8 | A) Tab |
| 9 | A) Use COPY ... TO 'file.csv' with FORMAT CSV |
| 10 | C) Superuser privilege |
| 11 | B) Use the HEADER option in the COPY command |
| 12 | D) XML |
| 13 | A) Use the COPY ... FROM command |
| 14 | C) json_populate_recordset() |
| 15 | B) The file encoding matches the database encoding |
| 16 | A) Converts empty strings to NULL |
| 17 | C) Both A and B |
| 18 | C) json_populate_recordset() |
| 19 | D) server_encoding |
| 20 | A) UTF-8 |
| 21 | A) ENCODING ‘utf-8’ |
| 22 | B) Errors occur for mismatched characters |
| 23 | B) pg_convert() |
| 24 | C) Using pg_dump and pg_restore with the desired encoding |
| 25 | A) pg_dump |
| 26 | A) A SQL script for recreating the database |
| 27 | B) Export data as CSV and open in Excel |
| 28 | B) OFFSET |
| 29 | B) Export data and compress manually using tools like gzip |
| 30 | C) pg_convert |