Bird
0
0

Find the error in this query: SELECT COUNT(DISTINCT) FROM customers;

medium📝 Debug Q7 of 15
SQL - Aggregate Functions
Find the error in this query: SELECT COUNT(DISTINCT) FROM customers;
ADISTINCT requires a column name
BCOUNT cannot be used with DISTINCT
CMissing FROM clause
DCOUNT(DISTINCT) counts all rows
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of COUNT(DISTINCT)

    DISTINCT must be followed by a column name to specify what to count distinctly.
  2. Step 2: Identify missing column name

    The query lacks a column name after DISTINCT, causing syntax error.
  3. Final Answer:

    DISTINCT requires a column name -> Option A
  4. Quick Check:

    COUNT(DISTINCT column) needs column name [OK]
Quick Trick: DISTINCT must have a column name after it [OK]
Common Mistakes:
MISTAKES
  • Omitting column name after DISTINCT
  • Thinking COUNT(DISTINCT) works without column
  • Misunderstanding DISTINCT usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes