All quizzesEasy
PostgreSQL Basics — Series 2
Preview — 3 of 10 questions
What does \du show in psql?
javascript
List of roles
Role name | Attributes
-----------+------------------------------------------------------------
app_user |
postgres | Superuser, Create role, Create DB, Replication, Bypass RLSALists all database roles/users, along with their attributes (superuser, can login, etc.)
BLists all user-defined functions
CLists all UPDATE statements in the query history
DShows disk usage per table
What does \c mydb do in psql?
javascript
psql> \c mydb
You are now connected to database "mydb" as user "postgres".ACreates a new database named mydb
BSwitches the current psql session's connection to the database named mydb
CCopies the current database to a new one named mydb
DChecks if a database named mydb exists, without connecting
What does \x toggle in psql?
javascript
psql> \x
Expanded display is on.
psql> SELECT * FROM users WHERE id = 1;
-[ RECORD 1 ]-------
id | 1
email | alice@x.com
bio | A very long bio field that would otherwise wrap awkwardly...AWhether SQL keywords are highlighted in a different color
BWhether query execution time is shown after each query
CExtended (vertical) display mode, where each column of a row is printed on its own line instead of the default wide tabular format — useful for wide rows with many columns
DWhether NULL values are shown as empty strings or the literal text NULL
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.