Re: Foreign Keys Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Dec 11, 2008, at 12:55 PM, Robert Cummings wrote:


On Thu, 2008-12-11 at 13:46 -0500, tedd wrote:

At 12:29 PM -0600 12/11/08, phphelp -- kbk wrote:

Hey tedd ---

Do I understand your structure correctly that you have something like:

Courses (table)
course_id,
subject_id,
student1_id,
student2_id,


That was right, but I think I've reconsidered.

You see, Richard pointed out the error of my ways, namely:





Student attendance should be a table with rows for each student in
attendance. If you want to limit the number make a check before adding
another student. Don't hard code the number via fields like above or
you'll find it overly ugly to add/remove students or even increase the


Right, Rob ---

As it happens I'm writing an application like this now, in late beta, ready to go live "any day now."

I call the table you are describing 'enrollment.'

So:

<STUDENTS>
 - student_id,
 - (rest of the fields)

<ENROLLMENT>
 - enroll_id
 - student_id
 - course_id
 - role_in_class
 - (more fields)

<COURSE>
 - course_id
 - subject_id
 - (more)

Except I take it one more step: Instructors are just People, as are Students. The role_in_class field distinguishes what they are doing in the classroom. (We have more roles than those in our application.)

Ken


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux