Oracle Database Administration I — Question 162
Which two statements are true about the COUNT function? (Choose two.)
Answer options
- A. COUNT (*) returns the number of rows in a table including duplicate rows and rows containing NULLs in any column.
- B. COUNT (DISTINCT inv_amt) returns the number of rows excluding rows containing duplicates and NULLs in the INV_AMT column.
- C. A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.
- D. It can only be used for NUMBER data types.
- E. COUNT (inv_amt) returns the number of rows in a table including rows with NULL in the INV_AMT column.
Correct answer: A, B
Explanation
The correct answers are A and B because COUNT(*) includes all rows, regardless of duplicates or NULLs, while COUNT(DISTINCT inv_amt) only counts unique values, excluding duplicates and NULLs. Option C is incorrect since a WHERE clause can be used with COUNT(DISTINCT), option D is false as COUNT can be used with various data types, and option E is incorrect because COUNT(inv_amt) excludes NULLs.