title: How i will get the latest record with average score
body: <p>I had this table<br />
  <a href="https://i.stack.imgur.com/u2TVf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u2TVf.png" alt="I had this table" /></a></p>
  <p>I need the table in this format
  <a href="https://i.stack.imgur.com/wyej3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wyej3.png" alt="enter image description here" /></a></p>
  <p>my sql query is</p>
  <pre><code>SELECT ID,NAME,SEM,MARKS AS FINAL_MARKS,avg(marks) as avg_score
  FROM STUDENT
  WHERE ID IN (SELECT MAX(ID) FROM STUDENT GROUP BY NAME)
  group by Name;
  </code></pre>