SQL Quiz: COUNT(*) vs COUNT(column)

COUNT(*), COUNT(column) and COUNT(DISTINCT column) look alike but count different things. This SQL quiz tests how each one treats NULL, empty strings and duplicates, with a classic trap or two.

मीडियम 10 सवाल ~6 मिनट पास होने के लिए 80% SQLite

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

What does this query return?

CREATE TABLE customers (name TEXT, email TEXT, phone TEXT);
INSERT INTO customers VALUES ('Ana', 'a@x.com', NULL), ('Ben', NULL, NULL), ('Cy', 'c@x.com', '555'), ('Dee', 'a@x.com', NULL);
SELECT COUNT(*), COUNT(email) FROM customers;
जवाब दिखाएं

D. 4|3 COUNT(*) counts all 4 rows. COUNT(email) skips the row where email is NULL, so it returns 3.

इस क्विज़ में क्या है

  • COUNT(*) counts rows, COUNT(column) counts non-NULL values
  • COUNT(DISTINCT column) and duplicates
  • COUNT(1) is the same as COUNT(*)
  • Finding missing values with COUNT(*) - COUNT(column)
  • Empty strings are not NULL

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।