Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLcomposite and partial indexesSingle-choice MCQ

You create a composite index on (a, b, c). For which of these WHERE/ORDER BY patterns can the index be used efficiently for both filtering and ordering, given the leftmost-prefix rule?

-- index: CREATE INDEX ix ON t (a, b, c); -- Option A WHERE a = 1 AND b = 2 ORDER BY c; -- Option B WHERE b = 2 AND c = 3; -- Option C WHERE a = 1 ORDER BY c; -- Option D WHERE c = 3 ORDER BY a;