A preview of what's in this quiz. Answer them interactively for instant scoring and full explanations.
In psql, which command lists all tables in the currently connected database?
1. In psql, which command lists all tables in the currently connected database?
- A.\dt
- B.\lt
- C.\show tables
- D.\d tables
Which SQL statement is used to create a new database in PostgreSQL?
2. Which SQL statement is used to create a new database in PostgreSQL?
- A.CREATE DATABASE <name>;
- B.ADD DATABASE <name>;
- C.NEW DATABASE <name>;
- D.INIT DATABASE <name>;
What is the legacy PostgreSQL-specific data type alias used to create auto-incrementing integer columns?
3. What is the legacy PostgreSQL-specific data type alias used to create auto-incrementing integer columns?
- A.SERIAL
- B.AUTO_INCREMENT
- C.IDENTITY
- D.SEQUENCE
Which SQL clause is used to limit the number of rows returned by a SELECT query in PostgreSQL?
4. Which SQL clause is used to limit the number of rows returned by a SELECT query in PostgreSQL?
- A.LIMIT
- B.TOP
- C.ROWCOUNT
- D.TAKE
Which data type in PostgreSQL is best suited for storing long, arbitrary-length text strings without a specific size limit?
5. Which data type in PostgreSQL is best suited for storing long, arbitrary-length text strings without a specific size limit?
- A.TEXT
- B.VARCHAR(255)
- C.CHAR
- D.STRING
What is PostgreSQL?
6. What is PostgreSQL?
- A.An open-source object-relational database management system
- B.A NoSQL key-value caching server
- C.A frontend web application server
- D.A cloud file storage hosting platform
What is the recommended modern way to define an auto-incrementing integer primary key column in PostgreSQL (PostgreSQL 10+)?
7. What is the recommended modern way to define an auto-incrementing integer primary key column in PostgreSQL (PostgreSQL 10+)?
- A.GENERATED BY DEFAULT AS IDENTITY
- B.AUTO_INCREMENT
- C.SERIAL PRIMARY KEY ONLY
- D.IDENTITY(1,1)
What is the name of the official command-line terminal client interface for PostgreSQL?
8. What is the name of the official command-line terminal client interface for PostgreSQL?
- A.psql
- B.pgAdmin
- C.postgres-cli
- D.sql-terminal
In psql, how do you exit the interactive command line utility?
9. In psql, how do you exit the interactive command line utility?
- A.\q
- B.\exit
- C.\quit
- D.\close
What does a CHECK constraint do in a PostgreSQL table definition?
10. What does a CHECK constraint do in a PostgreSQL table definition?
- A.It enforces that values in a column satisfy a boolean expression or condition.
- B.It checks if the database is online and connected.
- C.It verifies that a column references a valid primary key.
- D.It ensures that a column cannot contain duplicate values.
In psql, which command is used to connect to a specific database?
11. In psql, which command is used to connect to a specific database?
- A.\c <database_name>
- B.\connect_to <database_name>
- C.\use <database_name>
- D.\l <database_name>
In the psql command-line client, which command lists all available databases in the server?
12. In the psql command-line client, which command lists all available databases in the server?
How do you specify that NULL values should appear first in the sorted output of a SELECT query in PostgreSQL?
13. How do you specify that NULL values should appear first in the sorted output of a SELECT query in PostgreSQL?
- A.ORDER BY <column> NULLS FIRST
- B.ORDER BY <column> WITH NULLS
- C.ORDER BY NULLS, <column>
- D.ORDER BY <column> DEFAULT NULLS
Which SQL clause is used to skip a specific number of rows before returning query results in PostgreSQL?
14. Which SQL clause is used to skip a specific number of rows before returning query results in PostgreSQL?
- A.OFFSET
- B.SKIP
- C.LIMIT FROM
- D.START AT
How do you write a multi-line comment in PostgreSQL SQL scripts?
15. How do you write a multi-line comment in PostgreSQL SQL scripts?
- A.By enclosing the comment block in /* and */
- B.By prefixing each line with #
- C.By prefixing each line with --
- D.By enclosing the block in <!-- and -->
Which SQL-standard boolean values does the BOOLEAN data type accept in PostgreSQL inserts?
16. Which SQL-standard boolean values does the BOOLEAN data type accept in PostgreSQL inserts?
- A.TRUE and FALSE (along with variants like 't', 'f', '1', '0')
- B.YES and NO only
- C.Only integer values 1 and -1
- D.Any non-empty string value
Which SQL command is used to remove a column from an existing table in PostgreSQL?
17. Which SQL command is used to remove a column from an existing table in PostgreSQL?
- A.ALTER TABLE <table_name> DROP COLUMN <column_name>;
- B.ALTER TABLE <table_name> REMOVE <column_name>;
- C.ALTER TABLE <table_name> DELETE COLUMN <column_name>;
- D.MODIFY TABLE <table_name> DROP <column_name>;
What is the difference between the CHAR and VARCHAR data types in PostgreSQL?
18. What is the difference between the CHAR and VARCHAR data types in PostgreSQL?
- A.CHAR pads values with spaces to reach a fixed length; VARCHAR stores variable-length strings without padding.
- B.CHAR stores numbers; VARCHAR stores text characters.
- C.CHAR is unlimited in size; VARCHAR has a 255-character limit.
- D.CHAR is open-source; VARCHAR is a proprietary data type.
What is pgAdmin?
19. What is pgAdmin?
- A.A graphical web/desktop administration tool for managing PostgreSQL
- B.The default command-line client built into PostgreSQL
- C.A database server configuration file stored in the host system
- D.A software library used to run database replication clusters
Which operator is used for string concatenation in PostgreSQL?
20. Which operator is used for string concatenation in PostgreSQL?
Looking for a different topic? Browse all subjects