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?
- A. 3
- B. 4
- C. 6
- 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) क्या लौटाता है?
- A. 3
- B. 4
- C. 6
- D. 2
उत्तर: D. COUNT NULL की उपेक्षा करता है, और DISTINCT प्रत्येक मान की एक प्रति रखता है, जिससे Delhi और Pune बचते हैं: 2। NULL को मान गिनने पर 3 आता है; COUNT(City) 4 देता।
More Computer Awareness questions
- A transaction runs: INSERT row 1; SAVEPOINT s1; INSERT row 2; ROLLBACK TO s1; COMMIT. Which of the inserted rows are in the table…
- A transfer debits Account A, but the system crashes before Account B is credited. On restart, the debit is undone, so it is as if the…
- Two transactions run at the same time on the same accounts, yet the final result is the same as if one had run fully before the other…
- A database stores records as a tree in which every child record has exactly one parent, as in a company → department → employee chart…
- In the three-schema (ANSI/SPARC) architecture, the part of the database that one user group sees, such as the loan officers' view, is…
- A table has 8 columns and 120 rows. What are its degree and its cardinality?