title: How to make a composite key to be unique?
body: <p>I am making a database of students in one school.Here is what I have so far:
  <img src="https://i.stack.imgur.com/Jcgnx.png" alt="enter image description here"></p>
  
  <p><em>If you don't like reading jump to the "In short" part</em></p>
  
  <p>The problem is that I'm not happy with this design. I want the combination of <code>grade</code>, <code>subgrade</code> and <code>id_class</code> to be unique and to serve as a primary key for the students table.
  I can remove the <code>student_id</code> and make a composite key from the 3 but I don't want that either. Maybe I should make another table lets say <code>combination_id</code> where <code>grade</code>, <code>subgrade</code> and <code>id_class</code> are foreign keys and there is one extra column <code>comb_id</code> that serves as ID for the table. And all the columns will be Primary Keys. But the problem is that those 3 columns can still repeat because of that extra column (<code>comb_id</code>). For example I can have the same <code>grade</code>, <code>subgrade</code> and <code>class_id</code> but different <code>comb_id</code> which will make the row valid because of the composite key of the 4 columns of the table (<code>combination_id</code>).</p>
  
  <p>In short I want <code>students_id</code> to remain the only primary key of the table but to be a foreign key to another table which is somehow unique combination of <code>grades</code>, <code>subgrade</code> and <code>class_id</code>.</p>
  
  <p>If I was not clear enough ask in the comments below and thank you in advance.</p>
  
  <p>PS <em>I'm sorry for the indescriptive title but I'm bad at naming</em></p>
  
  <p><strong>EDIT 1:</strong>
  To be more clear:
  <code>grade</code> can be 1 to 12
  <code>subgrade</code> can be a to j
  <code>id_class</code> can be 1 to 30 and it is your number in class</p>
  
  <p>So a student can be from 7b class and his number in class - 5</p>