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

PostgreSQL_Objective_Questions_for_Data_Analysts

The document contains a series of objective questions related to PostgreSQL, covering topics such as data retrieval, data types, SQL commands, constraints, and functions. Each question provides multiple-choice answers to test knowledge on PostgreSQL functionalities. The questions address fundamental concepts like SELECT commands, data types for text and monetary values, and the use of JOINs and constraints.

Uploaded by

Eseoghene
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

PostgreSQL_Objective_Questions_for_Data_Analysts

The document contains a series of objective questions related to PostgreSQL, covering topics such as data retrieval, data types, SQL commands, constraints, and functions. Each question provides multiple-choice answers to test knowledge on PostgreSQL functionalities. The questions address fundamental concepts like SELECT commands, data types for text and monetary values, and the use of JOINs and constraints.

Uploaded by

Eseoghene
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CODEwithESE

PostgreSQL Objective Questions


1. Which command is used to retrieve data from a PostgreSQL table?

 A) INSERT
 B) UPDATE
 C) SELECT
 D) DELETE

2. In PostgreSQL, which data type would be most appropriate to store large amounts of text?

 A) VARCHAR
 B) INTEGER
 C) BOOLEAN
 D) TEXT

3. What command is used to remove all records from a table without deleting the table itself?

 A) DROP
 B) DELETE
 C) TRUNCATE
 D) REMOVE

4. Which of the following is NOT a PostgreSQL constraint?

 A) UNIQUE
 B) PRIMARY KEY
 C) FOREIGN KEY
 D) DUPLICATE

5. What does the LIMIT clause do in a SQL query?

 A) Restricts the number of columns returned


 B) Restricts the number of rows returned
 C) Sorts the result in descending order
 D) Joins tables together

6. What does the COUNT(*) function do?

 A) Counts all rows in a table, including null values


 B) Counts only rows with non-null values
 C) Returns the total sum of values in a column
 D) Counts distinct values only

7. Which of the following joins will return all rows when there is a match in either left or right table?

 A) INNER JOIN
 B) LEFT JOIN
 C) RIGHT JOIN
 D) FULL OUTER JOIN

8. Which of the following data types is used to store monetary values in PostgreSQL?

 A) MONEY
 B) DECIMAL
 C) FLOAT
 D) INTEGER

9. Which of the following options is used to create a new table?

 A) MAKE TABLE
 B) NEW TABLE
 C) CREATE TABLE
 D) INSERT TABLE

10. What does the GROUP BY clause do in a query?

 A) Sorts the results


 B) Limits the number of results
 C) Groups rows with the same values
 D) Filters out duplicate rows

11. Which operator is used for pattern matching in PostgreSQL?

 A) MATCH
 B) LIKE
 C) PATTERN
 D) EQUAL

12. How do you specify a primary key constraint in PostgreSQL?

 A) PRIMARY_KEY
 B) PK()
 C) PRIMARY KEY
 D) KEY PRIMARY

13. In PostgreSQL, which of the following would allow for automatic sequencing of numbers in a column?

 A) SERIAL
 B) INTEGER
 C) AUTO_INCREMENT
 D) INCREMENT

14. Which of the following aggregate functions would you use to find the average of values in a column?

 A) TOTAL
 B) SUM
 C) AVG
 D) COUNT

15. What is the result of the following query: SELECT DISTINCT column_name FROM table_name;?
 A) It selects only rows where column_name is unique
 B) It returns all rows in table_name
 C) It removes duplicate values in column_name
 D) It renames column_name

16. To remove duplicates in a query result, which keyword should be used?

 A) UNIQUE
 B) DISTINCT
 C) DISTINCTROW
 D) REMOVE

17. Which of the following commands would you use to update existing data in a table?

 A) MODIFY
 B) CHANGE
 C) UPDATE
 D) INSERT

18. What does the following SQL command do: DELETE FROM employees WHERE id = 10?

 A) Deletes the employees table


 B) Deletes the id column
 C) Deletes rows where id is 10
 D) Deletes all rows in employees

19. Which keyword is used to join multiple conditions in a WHERE clause?

 A) OR
 B) AND
 C) EITHER
 D) IF

20. What is a foreign key used for in PostgreSQL?

 A) To uniquely identify each record


 B) To enforce a link between data in two tables
 C) To allow null values in a column
 D) To store encrypted data

You might also like