SQL - Indexes and Query PerformanceWhich statement about NULL values in a UNIQUE index is true?ANULL values are treated as duplicates in UNIQUE indexesBNULL values are not allowed in UNIQUE indexesCOnly one NULL is allowed in a UNIQUE indexDMultiple NULLs are allowed in a UNIQUE indexCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall how NULLs behave in UNIQUE indexesMost SQL databases allow multiple NULLs in UNIQUE indexes because NULL means unknown, so they are not considered duplicates.Step 2: Evaluate each optionMultiple NULLs are allowed in a UNIQUE index correctly states multiple NULLs are allowed; others incorrectly restrict or treat NULLs as duplicates.Final Answer:Multiple NULLs are allowed in a UNIQUE index -> Option DQuick Check:UNIQUE index allows multiple NULLs [OK]Quick Trick: NULLs are not duplicates, so multiple NULLs allowed [OK]Common Mistakes:Assuming NULL counts as a duplicate valueBelieving UNIQUE forbids NULL valuesConfusing UNIQUE with PRIMARY KEY behavior
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