A database table is defined as customers(cust_id, name, city), and many customers can live in the same city. Which of the following SQL queries correctly returns a single number: the count of DIFFERENT cities in which the customers live?
SELECT COUNT(DISTINCT city) FROM customers;
SELECT COUNT(city) FROM customers;
SELECT city, COUNT(*) FROM customers GROUP BY city;
SELECT DISTINCT city FROM customers;
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore sql questions