Re: Foreign Keys Question

From: Date: Thu, 11 Dec 2008 19:12:37 +0000
Subject: Re: Foreign Keys Question
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-284497@lists.php.net to get a copy of this message
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

« previous php.general (#284497) next »