Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Why can an index on created_at not be used by WHERE YEAR(created_at) = 2024?

  1. A Because dates cannot be indexed
  2. B Because wrapping the column in a function prevents index use
  3. C Because YEAR is not a valid function
  4. D Because the index must be a primary key
Answer

Because wrapping the column in a function prevents index use

Applying a function to the column means the stored index values no longer match the comparison. Rewriting as a date range keeps the index usable.

All MySQL MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as