>I have a student.dbf having fields 1. Regno 2.name 3. Maths 4. Physics 5.Chemistry 6.Total 7. dob 8. category 9. Rank 10. MBC rank 11. sc rank.
>
>I have two types of category field namely 1.MBC 2.SC
>
> I want to put the rank based on the total marks field in Rank field and also put the category field rank in MBC field and SC field
>
> How to write the source code?
I don't know what the system is going to be used for, but assuming it is for some university, high school, or institute, I don't like the design of having math, physics, and chemistry in separate fields - there are several problems involved. Subjects, and their grades, should go into a separate table, one record for each subject.
Please consider the following:
With your design, to search for grades within one subject, you need to search in one field; for another subject, another field.
Consider that additional subjects may have to be added eventually.
Other semesters or years will have different subjects.
The student may take some subjects from one semester, and other subjects for other semesters - i.e., a different mix for individual students. The student may also take additional subjects.
The student may have to repeat individual subjects.
Even in schools where all the students take the same subjects, the required subjects may change slightly, from one year to the next.
You may need additional data for each subject a student takes; apart from the grade, you may want to put a note on whether it is a passing or failing grade; record whether any retries were granted; etc.
So, the recommended structure is a separate table, "registration" or "grades", with fields for student, subject, semester (or year), the final grade, and any additional information you may want to add for that student.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)