Tricky NULL Questions

This SQL quiz is all about NULL, the value that means "unknown" and breaks many people's intuition. You will predict how comparisons, NOT IN, aggregates, grouping and sorting treat NULL, and where SQLite, MySQL and PostgreSQL differ.

ยาก 10 ข้อ ~8 นาที ผ่านที่ 80% SQLite

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 10

What does this print?

SELECT CASE WHEN NULL = NULL THEN 'equal' ELSE 'not equal' END;
ดูเฉลย

B. not equal Comparing anything with NULL gives NULL (unknown), not true, so CASE falls through to ELSE. Use IS NULL, or IS NOT DISTINCT FROM in PostgreSQL (<=> in MySQL, IS in SQLite) to compare values that may be NULL.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • Why NULL = NULL is not true
  • NOT IN vs NOT EXISTS when the list contains NULL
  • Aggregates and COUNT with NULL values
  • Three-valued logic with AND and OR
  • Sorting and grouping NULL, and NULLIF / COALESCE

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง