You've made a lot of unnecessary work for yourself by creating 9 tables to hold data that should be stored in a single table. You'll need to run the count query, 9 times. Once for each table. You'll also need to use a join in the query:
Select G.StudentID, M.Grade, Count(*) AS CountOfGrades
From GradeTable As G Left Join MarksTable As M On G.Marks = M.Marks
Group By G.StudentID, M.Grade;