A Design Question using a fictious example

  • Background:

    I have two tables. Tests and Grades. For each Tests record there are many Grades; one for each student. The Grades table has a field called: StudentsGrade. Each time a Tests record is inserted into the database, an associated Grades record is inserted into the database, one for each student where the value of StudentsGrade is set to null.

    Question:

    My app has to list all of the Tests that the teacher hasn't finished grading. This query happens quite a bit. I have two ways of doing this:

    1. Select each Tests record where the associated students Grades record has a StudentsGrade of null, meaning the teacher hasn't graded all of the tests.
    2. Add a flag to the Tests table called EveryTestHasBeenGraded and set it's value to false until the teacher assigned a grade for each student who took that specific test.

    Normally I would always go with option number one. This is my first phone app. I was told that on phone apps that I need to minimize trips to the database as well as database joins where ever possible. Adding the flag into the Tests table does this by eliminating a join with the Grades table.

    I am curious if option number 2 is a better option for a phone app than option number one.

    Thanks

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply