
Answer-first summary for fast verification
Answer: The query will return the number of distinct values across all columns in the 'customers' table, excluding rows with any NULL values.
The `COUNT(DISTINCT *)` function counts all distinct rows in the 'customers' table where none of the columns have NULL values. In this scenario, if any row contains a NULL value in any column, it is excluded from the count. Therefore, the correct answer reflects the count of distinct rows excluding those with NULL values.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
What would be the result of executing the following SQL query on a table named 'customers'?
SELECT COUNT(DISTINCT *) FROM customers;
SELECT COUNT(DISTINCT *) FROM customers;
A
The query will return the total number of distinct rows in the 'customers' table, excluding any rows with NULL values in any column.
B
The query will return the total number of rows in the 'customers' table, including those with NULL values.
C
The query will return the number of distinct values in the first column of the 'customers' table.
D
The query will return the number of distinct values across all columns in the 'customers' table, excluding rows with any NULL values.
E
The query will return an error because the DISTINCT keyword cannot be used with *.