Enhance your PostgreSQL skills with this comprehensive collection of 30 multiple-choice questions. Covering connection methods, basic commands, database creation/deletion, and schema management, these questions are perfect for learners and professionals alike.
\d command do in psql?
\timing command in psql?
| Qno | Answer |
|---|---|
| 1 | B) psql -U <username> -d <database> |
| 2 | A) 5432 |
| 3 | B) PGUSER |
| 4 | B) psql -d testdb -U admin |
| 5 | B) psql -p <port_number> |
| 6 | C) \l |
| 7 | C) \c <database_name> |
| 8 | A) \h |
| 9 | C) Describes the structure of a table |
| 10 | C) \q |
| 11 | C) \dt |
| 12 | C) \g |
| 13 | D) SELECT version(); |
| 14 | A) Displays the time taken to execute queries |
| 15 | B) \du |
| 16 | A) CREATE DATABASE <db_name>; |
| 17 | A) Superuser |
| 18 | A) DROP DATABASE <db_name>; |
| 19 | A) \list |
| 20 | B) No |
| 21 | A) Organize tables and other database objects |
| 22 | C) public |
| 23 | C) \dn |
| 24 | C) CREATE SCHEMA <schema_name>; |
| 25 | B) All objects in the schema are removed |
| 26 | A) Yes |
| 27 | B) DROP SCHEMA <schema_name>; |
| 28 | C) SET search_path TO ‘<schema>’; |
| 29 | B) pg_namespace |
| 30 | B) ALTER SCHEMA <old_name> RENAME TO <new_name>; |