Databases · Middle · Question 2 of 75

There's an index on (last_name, first_name). Which query can use it efficiently?

Explanation

A composite index is sorted by the first column, then by the second within it, like a phone book. It helps queries on a leading prefix of its columns; searching only by first_name usually can't use it well.

Further reading

Problem with a question

Databases · Middle · question 2

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz