Re: [PHP] Foreign Keys Question

2008-12-12 Thread tedd
At 4:25 PM -0500 12/11/08, Robert Cummings wrote: On Thu, 2008-12-11 at 16:24 -0500, Robert Cummings wrote: > lock table check enrolment count no room unlock table generate error have room insert row unlock table Ba da boom. I should h

Re: [PHP] Foreign Keys Question

2008-12-12 Thread Waynn Lue
> > Waynn Lue wrote: > >> As a side note, FKs do enforce other table specific properties like >> indexes on the fields being constrained, so they do add value there as >> well. But there's of course an extra cost on updates and inserts to >> see if the FK is violated. >> > > On the external table?

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Chris
Waynn Lue wrote: As a side note, FKs do enforce other table specific properties like indexes on the fields being constrained, so they do add value there as well. But there's of course an extra cost on updates and inserts to see if the FK is violated. On the external table? No they don't. mysql

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Waynn Lue
As a side note, FKs do enforce other table specific properties like indexes on the fields being constrained, so they do add value there as well. But there's of course an extra cost on updates and inserts to see if the FK is violated. Waynn On 12/11/08, Colin Guthrie wrote: > 'Twas brillig, and C

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Robert Cummings
On Thu, 2008-12-11 at 16:24 -0500, Robert Cummings wrote: > On Thu, 2008-12-11 at 16:17 -0500, tedd wrote: > > At 3:14 PM -0500 12/11/08, Andrew Ballard wrote: > > > > > >That's the way to go. Just keep in mind that you will have to consider > > >ways of preventing overloading your courses due to c

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Robert Cummings
On Thu, 2008-12-11 at 16:17 -0500, tedd wrote: > At 3:14 PM -0500 12/11/08, Andrew Ballard wrote: > > > >That's the way to go. Just keep in mind that you will have to consider > >ways of preventing overloading your courses due to concurrency, > >whether you use table locks or devise your own mechan

Re: [PHP] Foreign Keys Question

2008-12-11 Thread tedd
At 3:14 PM -0500 12/11/08, Andrew Ballard wrote: That's the way to go. Just keep in mind that you will have to consider ways of preventing overloading your courses due to concurrency, whether you use table locks or devise your own mechanism. I don't know if you are allowing students to self-enro

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Andrew Ballard
On Thu, Dec 11, 2008 at 2:32 PM, tedd wrote: > At 1:55 PM -0500 12/11/08, Robert Cummings wrote: >> >> 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 fie

Re: [PHP] Foreign Keys Question

2008-12-11 Thread tedd
At 1:55 PM -0500 12/11/08, Robert Cummings wrote: 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

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Robert Cummings
On Thu, 2008-12-11 at 13:56 -0500, tedd wrote: > At 1:48 PM -0500 12/11/08, Robert Cummings wrote: > >On Thu, 2008-12-11 at 13:27 -0500, Bastien Koert wrote: > > > On Thu, Dec 11, 2008 at 12:56 PM, tedd > > > > > > Does anyone have any example code to show me the actual syntax? > > > > > Joins

Re: [PHP] Foreign Keys Question

2008-12-11 Thread phphelp -- kbk
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,

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Robert Cummings
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, > >student3_id, > >stu

Re: [PHP] Foreign Keys Question

2008-12-11 Thread tedd
At 1:48 PM -0500 12/11/08, Robert Cummings wrote: On Thu, 2008-12-11 at 13:27 -0500, Bastien Koert wrote: > On Thu, Dec 11, 2008 at 12:56 PM, tedd > > Does anyone have any example code to show me the actual syntax? > Joins should allow you to pull the data from the table in one query You w

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Robert Cummings
On Thu, 2008-12-11 at 13:27 -0500, Bastien Koert wrote: > On Thu, Dec 11, 2008 at 12:56 PM, tedd > > > > I believe I can create the Course table (excluding everything not germane) > > like so: > > > > INDEX (student_id), > > FOREIGN KEY (student_id) > > REFERENCES (students(id)), > > INDEX (ins

Re: [PHP] Foreign Keys Question

2008-12-11 Thread tedd
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, student3_id, student4_id, Is that right? Ken Ken: That was right, but I think I've reconsi

Re: [PHP] Foreign Keys Question

2008-12-11 Thread phphelp -- kbk
Hey tedd --- Do I understand your structure correctly that you have something like: Courses (table) course_id, subject_id, student1_id, student2_id, student3_id, student4_id, Is that right? Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsu

Re: [PHP] Foreign Keys Question

2008-12-11 Thread Bastien Koert
On Thu, Dec 11, 2008 at 12:56 PM, tedd wrote: > Hi gang: > > I know this is a MySQL question, but I get a better reply from this group > than the MySQL list (no offense meant to that list) -- In any event, here > goes. > > I currently have a project that's a classic example of a relational > data