Question · SQL and MySQL course · Module 9: Indexes and normalization

Column order in an index

Why does the order of columns in a composite index matter?

Answer options

  • Because the columns must be in alphabetical order, otherwise the index will not be created
  • The order does not matter at all
  • Because the index works best when we filter by the first column (or starting from the first in order)
  • Because the last column becomes the primary key

You can check the correct answer by solving this task in the CodeWorlds game.