Oracle Database SQL — Question 8
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. It can only be used for NUMBER data types.
- C. COUNT(DISTINCT inv_amt) returns the number of rows excluding rows containing duplicates and NULLs in the INV_AMT column.
- D. COUNT(inv_amt) returns the number of rows in a table including rows with NULL in the INV_AMT column
- E. A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.
Correct answer: A, C
Explanation
Option A is correct as COUNT(*) indeed counts all rows, including duplicates and NULLs. Option C is also correct because COUNT(DISTINCT inv_amt) specifically excludes duplicates and NULLs in the counting process. Options B, D, and E are incorrect; COUNT can be used with various data types, COUNT(inv_amt) does not include NULLs, and COUNT with DISTINCT can have a WHERE clause.