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. Is that correct? The only other answer that I can think of is to setup a field in 'clients' that behaves like an array, and putting a list of each employee in that array. Besides the fact that there seems to be no such thing as a field[array] datatype in mySQL, it seems to break even the most basic rule of normalization (each field contains one and only one piece of data.) I know it's a very basic question... appreciate any answers. I have the 'client' and 'employee' tables working individually quite nicely... I just don't know what the CORRECT method is to establish many-to-many relationships. (BTW... putting things in words really helps... thinking more clearly already!) Thanks in advance. ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/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/
