0% found this document useful (0 votes)
11 views

PostgreSQL_MCQs_with_Answers

The document contains multiple choice questions (MCQs) related to PostgreSQL, covering topics such as database commands, data types, constraints, and functions. Each question is followed by the correct answer, providing a comprehensive overview of PostgreSQL functionalities. It serves as a study guide for individuals looking to enhance their knowledge of PostgreSQL.

Uploaded by

NITHYA K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

PostgreSQL_MCQs_with_Answers

The document contains multiple choice questions (MCQs) related to PostgreSQL, covering topics such as database commands, data types, constraints, and functions. Each question is followed by the correct answer, providing a comprehensive overview of PostgreSQL functionalities. It serves as a study guide for individuals looking to enhance their knowledge of PostgreSQL.

Uploaded by

NITHYA K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PostgreSQL Multiple Choice Questions (MCQs) with Answers

1. Which of the following is true about PostgreSQL?

Answer: D. All of the above

2. What is the default port number for PostgreSQL?

Answer: D. 5432

3. Which command is used to connect to a PostgreSQL database from the terminal?

Answer: A. psql

4. Which keyword is used to remove a database in PostgreSQL?

Answer: C. DROP

5. What is the use of the SERIAL data type in PostgreSQL?

Answer: B. To auto-increment integer values

6. Which command is used to list all databases in PostgreSQL?

Answer: B. \l

7. Which of the following is used to create an index in PostgreSQL?

Answer: A. CREATE INDEX

8. What does VACUUM command do in PostgreSQL?

Answer: B. Optimizes performance by cleaning up dead tuples

9. Which command is used to see the structure of a table in PostgreSQL?

Answer: C. \d table_name

10. Which of the following is not a valid data type in PostgreSQL?

Answer: D. STRING
PostgreSQL Multiple Choice Questions (MCQs) with Answers

11. What is the purpose of the UNIQUE constraint in PostgreSQL?

Answer: B. To ensure all values in a column are different

12. Which clause is used to filter the result set based on a condition?

Answer: C. WHERE

13. Which type of join returns all rows when there is a match in either left or right table?

Answer: D. FULL OUTER JOIN

14. What will the following query do? ROLLBACK;

Answer: B. Undo all uncommitted changes

15. What does NOW() function return in PostgreSQL?

Answer: C. The current timestamp

16. Which of the following is used to define a custom function in PostgreSQL?

Answer: C. CREATE FUNCTION

17. What is the use of COALESCE() function?

Answer: B. To return the first non-null value

18. What does IS NULL check for in a query?

Answer: C. Null values

19. Which PostgreSQL command is used to remove a column from a table?

Answer: C. DROP COLUMN

20. Which of the following is true about foreign keys?

Answer: D. All of the above


PostgreSQL Multiple Choice Questions (MCQs) with Answers

21. What is PL/pgSQL in PostgreSQL?

Answer: B. A procedural language used to write functions and triggers

22. Which keyword is used to start a PL/pgSQL block?

Answer: A. BEGIN

23. In PL/pgSQL, how is a variable declared?

Answer: C. DECLARE name INT := 0;

24. What is a trigger in PostgreSQL?

Answer: B. A function that runs automatically in response to certain events

25. Which statement is used to create a trigger in PostgreSQL?

Answer: B. CREATE TRIGGER

26. Which timing options are valid for a trigger?

Answer: D. All of the above

27. What does the EXPLAIN command do in PostgreSQL?

Answer: B. Analyzes the query plan without executing

28. Which index type is best for full-text search in PostgreSQL?

Answer: C. GIN

29. What does the ANALYZE command do?

Answer: C. Collects statistics for the query planner

30. What is the purpose of a materialized view in PostgreSQL?

Answer: C. To store query results and improve performance

You might also like