If you're asking whether you can write a Cypher query to MATCH to your data for grades students have received, categorize the grades by score, sum the number of each letter grade, and then output some result, then yes that is possible. A graph database would not be the recommended tool for this kind of use case, since it's not especially graphy, and doesn't seem to require a lot of relationships or traversals, but it is doable. If your aim is to find a database that allows storage of logic and categorization like this, Neo4j probably isn't the right tool, as the logic for this would live in the query you submit, it isn't in something you store.
To show how this would work in Neo4j, you would probably have :Student nodes, :Course nodes, some relationship between, and some score for the examination. The examination might be represented as a relationship, or as a node between the student and the course.
Let's try the latter:
(:Student)-[:ENROLLED_IN]->(:Course)
(:Student)-[:TOOK_EXAM]->(:Exam)-[:EXAM_FOR_COURSE]->(:Course)
There are other things that would probably occur in a real data set, like terms, and other things, but let's go with this. An :Exam will have a score, and it would be best if the letter grade was set at the time the scoring was saved in the graph, something like this when setting an exam score for an existing student and course:
MATCH (student:Student {id:$studentId})-[:ENROLLED_IN]->(course:Course {id:$courseId})
MERGE (student)-[:TOOK_EXAM]->(ex:Exam {number:$examId})-[:EXAM_FOR_COURSE]->(course)
SET ex.score = $score
SET ex.letterGrade = CASE WHEN 90 <= $score <= 100 THEN 'A'
ELSE WHEN 80 <= $score <= 89 THEN 'B'
ELSE WHEN 60 <= $score <= 79 THEN 'C'
ELSE 'D' END
With that data saved, here's a query to output, per student, their rating per course:
MATCH (s:Student)
CALL {
WITH s
MATCH (s)-[:TOOK_EXAM]->(ex:Exam)-[:EXAM_FOR_COURSE]->(course:Course)
WITH course, collect(ex.letterGrade) as grades
WITH course, any(grade IN grades WHERE grade = 'D') as receivedDGrade, apoc.coll.occurrences(grades, 'A') as gradeAs
WITH course, CASE WHEN receivedDGrade THEN 'failed'
WHEN (7 <= gradeAs) THEN 'outstanding'
WHEN 5 <= gradeAs THEN 'good'
ELSE 'passed' END as rating
RETURN rating
}
RETURN s.name as student, rating