PostgreSQL Objective Questions & Answers for Beginners Set-2
1. What is the purpose of the "DISTINCT" keyword in a SELECT statement?
Explanation: The "DISTINCT" keyword is used to eliminate duplicate rows from the result of a SELECT query, returning only unique values
2. What is the default data type for a PostgreSQL serial column?
Explanation: The "SERIAL" data type is used for auto-incrementing columns in PostgreSQL. It is an alias for the "INTEGER" data type with an associated sequence.
3. Which SQL clause is used to join tables based on a common column?
Explanation: The "JOIN" clause is used to combine rows from two or more tables based on a related column between them.
4. What is the purpose of the "NULL" value in a PostgreSQL database?
Explanation: The "NULL" value is used to represent a missing or unknown value in a PostgreSQL database.
5. What is the purpose of the PostgreSQL "pg_dump" utility?
Explanation: The "pg_dump" utility is used to generate a text or binary file containing the SQL statements needed to recreate the database's schema and data.
6. In PostgreSQL, what is the difference between the "INNER JOIN" and "LEFT JOIN" clauses?
Explanation: In a "LEFT JOIN," all rows from the left table are returned, along with matching rows from the right table. In an "INNER JOIN," only matching rows from both tables are returned.
7. What is the purpose of the PostgreSQL "pgAdmin" tool?
Explanation: "pgAdmin" is a popular administration and management tool for PostgreSQL databases, allowing users to interact with databases, perform backups, and more.
8. Which PostgreSQL data type is used to store date and time values?
Explanation: The "TIMESTAMP" data type is used to store date and time values with millisecond precision in PostgreSQL.
9. What is the purpose of the PostgreSQL "VACUUM" command?
Explanation: The "VACUUM" command is used to reclaim storage space and optimize PostgreSQL database tables.
10. Which SQL statement is used to remove a table from a PostgreSQL database?
Explanation: The "DROP TABLE" statement is used to remove a table and its associated data and indexes from a PostgreSQL database.
11. What is the purpose of the "COALESCE" function in PostgreSQL?
Explanation: The "COALESCE" function returns the first non-null value from a list of arguments. It's often used to handle null values gracefully.
12. What does the term "transaction" refer to in a PostgreSQL database?
Explanation: A transaction in PostgreSQL is a sequence of SQL statements that are executed together as a single unit of work, either fully completed or fully rolled back.
13. What is the purpose of the "CASE" statement in SQL?
Explanation: The "CASE" statement is used to perform conditional logic within a SQL query, allowing you to apply different expressions based on specified conditions.
14. In PostgreSQL, what is a "composite key"?
Explanation: A composite key in PostgreSQL consists of multiple columns that together uniquely identify a row in a table
15. What is the purpose of the "ENUM" data type in PostgreSQL?
Explanation: The "ENUM" data type in PostgreSQL is used to store enumerated values as strings, allowing you to define a list of acceptable values for a column.
Related content
Rate Your Experience
: 89
: 1