Thanks to everyone for the answers. It's reassuring to know that I'm on the right track. Concerning tracking multiple events, I really don't like 'freeform' text, so I will probably add an additional table for 'type of work' and make it a lookup table for the tracking table. If I allow freeform text, it's actually more work in the long run, since I can't just pick an option, I have to type. And it makes searching less reliable to allow freeform text. So now I have 5 columns: client, employee, type of work, date start, date end. Things get complicated quick. And this is just the beginning. Whew!
--- In [email protected], Pete <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, edcasati <[EMAIL PROTECTED]> > writes > >I'm working on my first 'real' PHP / MySQL database, and I'm somwhat > >confused about how to 'relate' data. > > > >Imagine running a temp agency. You have two basic mySQL tables: > >Table1 is employees > >Table 2 is Clients > > > >Each client and employee has one entry in their respective database. > >I want to setup the database so I can keep track of which employee has > >worked with which client, and which client has used each employee. An > >employee can work for multiple clients, and a client can use multiple > >employees. > > > >How do I track those relationships? > > >My guess is that the only way is to setup a separate table, with one > >column keyed to employee and another table keyed to client, and have > >them point to the appropriate entities. So in essence there is a third > >table that tracks the relationships, but doesn't contain any 'real' > >data, just pointers to the appropriate row in the 'real' tables. > > That is correct. However, this 'assignments' table, could also show the > dates of the assignment, what the assignment was for ('typing minutes of > meeting'), and how much was charged, etc. > > -- > Pete Clark > > http://www.hotcosta.com > http://www.spanishholidaybookings.com ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CefplB/TM --------------------------------------------------------------------~-> The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
