Subject saving null values to database
Author Sergio H. Gonzalez
Hello there! I have this situation, and would like to hear some advice
about the best way to do it. My app has to save some results of a bunch
of clinical exams wich I have in a table:

table_exams:

id description
-----------------
1 test 1
2 test 2
3 test 3
4 test 4

and i save the results like this

table_results:

id id_table_exams result
----------------------------
1 1 100
2 3 98
3 4 55

As you can see, not all the exams has a result all the times...

The user dont want to choose each exam and enter the result. He want to
have all the exams displayed in a grid and just fill the result he has
at the moment.

So I was thinking in creating in table_results all the records to hold
the results (from table_exams) and just leave in null the ones that are
not used. I know that it's a waste of space, having such empty results,
but this way is much more easy to maintain the table. For instance, if
the user, later wants to add a result, I already have the empty record.

If I don't want to save null results, I imagine I have to use a temp
table and fill it any time the user wants to add results, and then just
save the records that have results.

So the question is: it's too bad to save all the records and leave some
with null results? or I ought to work a bit more and use a temp table?
Or perhaps, there is another better way to do this?

I hope I'm clear with my question!!!!

thanks

-s








[Non-text portions of this message have been removed]