title: SQL Query for finding the highest mark
body: <p>I am currently working on a small application</p>
  
  <p>I have two demo table <code>studentdetails</code> and <code>studentmarks</code>...</p>
  
  <p>The <code>studentdetails</code> table have the following column: </p>
  
  <pre><code>student_id(primary key), name, batch, address and telephone number
  </code></pre>
  
  <p>The <code>studentmarks</code> table have the following column: </p>
  
  <pre><code>student_id (foreign key to student_id column of studentdetails), physics, maths, english, chemistry
  </code></pre>
  
  <p>My question is how do i find the highest mark achieved by students by each subject???</p>
  
  <p>The output will be: <code>(name, subject, marks)</code>.</p>
  
  <p>Is this possible with my given structure?</p>
  
  <p>sample data for <code>studentdetails</code>:</p>
  
  <pre><code>-------------------------------
      (001, studentname1, 01, Address1, 1234567),
      (002, studentname2, 01, Address2, 2345678),
      (003, studentname3, 01, Address3, 3456789)
  </code></pre>
  
  <p>sample data for <code>studentmarks</code>:</p>
  
  <pre><code>-------------------------------
      (001, 77, 87, 99, 70), 
      (002, 92, 68, 97, 80), 
      (003, 88, 78, 90, 66)
  </code></pre>