title: MySQL rating database structure
body: <p>I'm trying to create a database that stores the students grade for each homework assignment I want to be able to store the grade and how many times that student got a certin grade for example a student got an <code>A+ 30 times</code>, for each student, as well as how many grades a student got. And how much a grade is worth in points for example an <code>A is worth 4.3</code>. </p>
  
  <p>So I was wondering what is the best way to build my MySQL database what do I need to add and what do I need to drop and how can I store numbers like <code>4.3</code> for example.</p>
  
  <p>My database so far</p>
  
  <pre><code>CREATE TABLE grades (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  grade INT UNSIGNED NOT NULL,
  student_work_id INT UNSIGNED NOT NULL,
  student_id INT UNSIGNED NOT NULL,
  date_created DATETIME NOT NULL,
  PRIMARY KEY (id)
  );
  
  CREATE TABLE work (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  student_id INT UNSIGNED NOT NULL,
  title TEXT NOT NULL,
  content LONGTEXT NOT NULL,
  PRIMARY KEY (id)
  );
  
  CREATE TABLE IF NOT EXISTS student (
  id int(8) NOT NULL auto_increment,
  student varchar(20) NOT NULL,
  PRIMARY KEY  (`id`)
  )
  </code></pre>
  
  <p>example of output.</p>
  
  <pre><code>student |   grade   |   count
  
      1       A           10
      1       C           2
      1       F           4
      2       B           20
      2       B-          3
      2       C+          10
  
  
  student |   grade   |   points
  
      1       A           4.3
      2       B+          3.3
      3       B-          2.7
      4       D+          1.3
  
  
  student |   total grades
  
      1       90
      2       80
      3       100
      4       1
  </code></pre>