SQL - Indexes and Query PerformanceWhy does a UNIQUE index allow multiple NULL values but still enforce uniqueness on non-NULL values?ABecause UNIQUE indexes ignore NULL values completelyBBecause NULL is treated as zero internallyCBecause NULL means unknown, so NULLs are not considered equalDBecause NULL values are automatically converted to unique stringsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the meaning of NULL in SQLNULL represents unknown or missing data, so two NULLs are not equal to each other.Step 2: Explain UNIQUE index behavior with NULLsSince NULLs are not equal, UNIQUE index allows multiple NULLs but enforces uniqueness on actual known values.Final Answer:Because NULL means unknown, so NULLs are not considered equal -> Option CQuick Check:NULLs are unknown, so multiple allowed in UNIQUE [OK]Quick Trick: NULL means unknown, so multiple NULLs allowed [OK]Common Mistakes:Thinking NULL equals zero or empty stringAssuming UNIQUE ignores NULLs entirelyBelieving NULLs are converted to unique strings
Master "Indexes and Query Performance" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Window Functions - Percent of total with window functions - Quiz 12easy CASE Expressions - Why CASE expressions are needed - Quiz 5medium CASE Expressions - Nested CASE expressions - Quiz 10hard CASE Expressions - Nested CASE expressions - Quiz 1easy CASE Expressions - CASE with aggregate functions - Quiz 5medium Common Table Expressions (CTEs) - CTE as readable subquery replacement - Quiz 15hard Indexes and Query Performance - How an index works (B-tree mental model) - Quiz 7medium Indexes and Query Performance - CREATE INDEX syntax - Quiz 1easy Indexes and Query Performance - EXPLAIN plan for query analysis - Quiz 14medium SQL Security Basics - Why SQL security awareness matters - Quiz 2easy