Q1
True / FalseIn PostgreSQL, each row in a table must have a unique identifier.
While it is common to have a unique identifier like a primary key for each row, it is not a strict requirement in PostgreSQL. However, having a unique identifier is a best practice for data integrity.
Q2
True / FalseIn PostgreSQL, the data type of a column can be defined when creating the table.
When creating a table in PostgreSQL, you specify the data type for each column to define what kind of data it will hold, such as INTEGER, VARCHAR, DATE, etc.
Q3
True / FalseIn PostgreSQL, the NOT NULL constraint ensures that a column cannot have NULL values.
The NOT NULL constraint in PostgreSQL ensures that a column must have a value and cannot be left empty or NULL.
Q4
True / FalsePostgreSQL allows you to rename a column in an existing table using the ALTER TABLE statement.
PostgreSQL provides the ALTER TABLE ... RENAME COLUMN ... TO ... command to rename columns in an existing table.
Q5
True / FalseIn PostgreSQL, the UNIQUE constraint allows duplicate values in the specified column.
The UNIQUE constraint ensures that all values in a column are distinct, preventing duplicate values.
Q6
True / FalseIn PostgreSQL, you can define default values for columns in a table.
PostgreSQL allows you to set default values for columns using the DEFAULT keyword, which will be used if no other value is provided during insertion.
Q7
True / FalsePostgreSQL supports array data types, allowing a column to store multiple values in a single row.
PostgreSQL supports array data types, enabling columns to store arrays of values, such as INTEGER[] or TEXT[].
Q8
True / FalseIn PostgreSQL, the ROW_NUMBER() window function can be used to assign unique sequential integer values to rows within a partition of a result set.
The ROW_NUMBER() window function in PostgreSQL assigns a unique sequential integer to rows within a partition, providing a way to number rows.
Q9
True / FalsePostgreSQL does not support the ability to store JSON data in table columns.
PostgreSQL supports JSON and JSONB data types, allowing you to store and manipulate JSON data directly within table columns.
Q10
True / FalseIn PostgreSQL, the GENERATED ALWAYS AS IDENTITY clause can be used to create auto-incrementing columns.
The GENERATED ALWAYS AS IDENTITY clause in PostgreSQL is used to define auto-incrementing columns, providing a standardized way to create sequence-generated unique identifiers.
Q23
Multiple ChoiceWhich SQL command would you use to add a new row to a PostgreSQL table?
SQL Code
INSERT INTO customers (first_name, last_name, email)
VALUES ('Jane', 'Doe', 'jane.doe@example.com');
This query inserts a new row into the 'customers' table with specific values for the 'first_name', 'last_name', and 'email' columns, adding a new entry to the table.