Gordon
Gordon

Reputation: 57

mysql field data types

i have the following tables: SUbjects table schema:(id,subject_code), and gradings_level table schema: (id,subject_id,grade,points,marks_range). this is for an examination results. A subject can have many grading levels in this form if marks are out of 100::

subject_id marks_range grade points
123        0-30        E     4
123        30-50       D     6
123        50-70       C     7
123        70-80       B     8
123        80-100      A     12

that kind of system for all subjects in the database.

my question is?

is it possible for me to store the marks_range in the database so it can be used for each subject or i have to put the logic in a php script

Upvotes: 0

Views: 120

Answers (1)

pavel
pavel

Reputation: 27082

Store the range in database, but the better variant is to store two int columns.

marks_range_begin | marks_range_end

It's nonsense to make changes in the application when you just want to change makrs range. It's a task for somebody who can manage that in CMS, so, technically, change the value(s) in the database.

Upvotes: 1

Related Questions