title: SQL How to: from two tables that has 2 same data in other named columns, one of them need to be counted
body: <p><em>Hello there. I am not good in combining and indexing data from two or more tables in SQL databases and I want to learn it.
  I am in need of help, I have modeling situation like this:
  I have two tables:</em></p>
  
  <p>STUDENTS:</p>
  
  <pre><code>ID, FIRST_NAME, LAST_NAME,DATE_OF_BIRTH, CLASS,
  1, Petr, Fish, 4.3.1984, 4A
  2, John, Stone, 5.5.1990, 4A
  3, Jack, Clark, 6.3.1983, 4A
  4, George, Field, 5.8.1955, 4A
  5, John, Rock, 6.1.1999, 4B
  6, Patrick, Light, 1.11.1983, 4B
  </code></pre>
  
  <p><em>and</em></p>
  
  <p>POINTS_MATH:</p>
  
  <pre><code>STUDENT_ID, POINTS
  1, 15
  1, 20
  2, 30
  3, 11
  3, 5
  4, 3
  </code></pre>
  
  <p><em>ID in first table and STUDENTS_ID in second represent same values, for result rows with same STUDENTS_ID must be counted and assigned to right ID 
  and I need result table:</em></p>
  
  <p>ID, FIRST_NAME, LAST_NAME,DATE_OF_BIRTH, CLASS, (sum of POINTS by STUDENTS_ID)</p>
  
  <p><em>in case a) it may seen:</em> </p>
  
  <pre><code>ID, FIRST_NAME, LAST_NAME,DATE_OF_BIRTH, CLASS, (sum of points by ID(STUDENTS_ID))
  1, Petr, Fish, 4.3.1984, 4A, 35
  2, John, Stone, 5.5.1990, 4A, 30
  3, Jack, Clark, 6.3.1983, 4A, 16
  4, George, Field, 5.8.1955, 4A, 3
  </code></pre>
  
  <p><em>in case b) also with "no points" result, it may seen:</em></p>
  
  <pre><code>ID, FIRST_NAME, LAST_NAME,DATE_OF_BIRTH, CLASS, (sum of points by ID(STUDENTS_ID))
  1, Petr, Fish, 4.3.1984, 4A, 35
  2, John, Stone, 5.5.1990, 4A, 30
  3, Jack, Clark, 6.3.1983, 4A, 16
  4, George, Field, 5.8.1955, 4A, 3
  5, John, Rock, 6.1.1999, 4B, unknown
  6, Patrick, Light, 1.11.1983, 4B, unknown
  </code></pre>
  
  <p><em>And one more question: how and which kind of index can I use for more efective query in case of plenty datas?
  Thanks very much for every answer.</em></p>