Computer AwarenessVery hardIBPS SO IT Officer

A City column holds Delhi, Pune, Delhi, NULL, Pune, NULL in six rows. What does SELECT COUNT(DISTINCT City) return?

  1. A. 3
  2. B. 4
  3. C. 6
  4. D. 2

Correct answer: D. 2

COUNT ignores NULLs, and DISTINCT keeps one copy of each value, leaving Delhi and Pune: 2. Counting NULL as a value gives 3; COUNT(City) would give 4.

हिंदी में

छह पंक्तियों में City स्तंभ में Delhi, Pune, Delhi, NULL, Pune, NULL हैं। SELECT COUNT(DISTINCT City) क्या लौटाता है?

  1. A. 3
  2. B. 4
  3. C. 6
  4. D. 2

उत्तर: D. COUNT NULL की उपेक्षा करता है, और DISTINCT प्रत्येक मान की एक प्रति रखता है, जिससे Delhi और Pune बचते हैं: 2। NULL को मान गिनने पर 3 आता है; COUNT(City) 4 देता।

More Computer Awareness questions

Exams that ask this topic