
Explanation:
The correct answer is E: the query will return an error because DISTINCT cannot be used with * in COUNT(DISTINCT *). COUNT(DISTINCT ...) requires a single column or expression, not all columns at once, so COUNT(DISTINCT *) is invalid syntax. stackoverflow
COUNT(DISTINCT *). A distinct-row count would need a subquery such as SELECT COUNT(*) FROM (SELECT DISTINCT * FROM customers) t. stackoverflowCOUNT(*) counts all rows, but that is not what this query does.* does not mean the first column in COUNT(DISTINCT *).DISTINCT * as distinct values across all columns inside COUNT(); that syntax is invalid. forums.sqlteamFor Databricks SQL, remember this pattern: COUNT(DISTINCT col) is valid, but COUNT(DISTINCT *) is not. If you need distinct rows, count them via a subquery that selects DISTINCT * first. databricks
Ultimate access to all questions.
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 *.