Wanted information about handling database.

  • Thread starter Thread starter Shyam Singh
  • Start date Start date
S

Shyam Singh

I have two database Student and Course both have a
relation on it. Student ID is the primary key for Student
Table and Course ID is the primary key for course table.
As per my logic, one student can enroll for different
courses. Say X person can enrol for Y1, y2, y3 courses. I
want to store data in the database in the format X/Y1 if
the MR X person enrols for Y1 course and according X/Y2 if
he enrolls for Y2 course and so on.

Please help me on what can be done to implement this
logic. I have a hint for this is the use of Substring
function.
 
You can use a linking table, with StudentID, CourseID and you can make this
a key of the linking table.

So Student has Students 1, 2, 3, 4, 5, and Courses has Y1, Y2, Y3, Y4

Linking table
1, Y1
1, Y2
1, Y3
1, Y4
2, Y1
3, Y2
4, Y1
4, Y2

etc...

and if relate them back to each respective parent, you won't have the
possibility of any junk records/orphans.

HTH,

Bill
 
Back
Top