Q. Which query would count the number of distinct cities in the ‘Customers’ table?

A
SELECT COUNT(*) FROM Customers
B
SELECT COUNT(DISTINCT City) FROM Customers
C
SELECT DISTINCT COUNT(City) FROM Customers
D
SELECT CITY COUNT FROM Customers
Solution:

COUNT(DISTINCT column) counts only unique values in the specified column, avoiding duplicate counts.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!