title: Does the Left most column matters in Indexing in MySQL?
body: <p>I need to know that Left most column matters in Indexing </p>
  
  <p>My Table contains following fields</p>
  
  <pre><code>id (int Primary key)
  first_name(varchar(50))
  last_name varchar(50)
  </code></pre>
  
  <p>and my Index is </p>
  
  <pre><code>Create index ix_name_1 on name(last_name,first_name)
  </code></pre>
  
  <p><strong>Query</strong></p>
  
  <p>When I am running the following query it takes the proper index</p>
  
  <pre><code>Select *
  from name
  where first_name = 'firstName' and last_name ='lastName'
  </code></pre>
  
  <p>or</p>
  
  <pre><code>select *
  from name
  where last_name = 'lastName' and first_name = 'firstName'
  </code></pre>
  
  <p>But When I am running </p>
  
  <pre><code>Select * from name where first_name = 'firstName'
  </code></pre>
  
  <p>it goes to a table scan. </p>
  
  <p>On thing I found with this is last_name is the left most column and I tried the same for a different table and different queries by missing the left most column in where clause the same happens.</p>
  
  <p>So I need to know Left most column matters in Indexing </p>