All quizzesEasy
PostgreSQL Basics
Preview — 3 of 10 questions
What is the difference between \dt and \d tablename in the psql CLI?
A\dt shows table data, \d tablename shows indexes only
B\dt lists all tables in the current schema, \d tablename describes the structure (columns, types, constraints) of a specific table
CBoth commands are identical
D\dt drops a table, \d tablename deletes a row
Which statement correctly describes the difference between SERIAL and GENERATED ALWAYS AS IDENTITY?
ASERIAL creates a sequence and sets the default, but the column is not truly an identity column; GENERATED ALWAYS AS IDENTITY is the SQL-standard approach that prevents manual inserts by default
BThey are completely identical; GENERATED ALWAYS AS IDENTITY is just newer syntax
CSERIAL requires PostgreSQL 10+, while GENERATED ALWAYS AS IDENTITY works on older versions
DGENERATED ALWAYS AS IDENTITY only works with BIGINT, not INT
What does the RETURNING clause do in a PostgreSQL INSERT statement?
AIt returns specified columns (or *) from the inserted row(s) after the operation completes
BIt rolls back the insert if the returned value is NULL
CIt is only valid for UPDATE statements
DIt requires a trigger to be defined on the table
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.