I'd be glad to share.. you mean what the db is supposed to be? Ok,
there are 3 tables:
table1 = people, people_id = primary key
table2 = machines, machines_id = primary key
One person can have many machines, one machine can only be assigned to
The way I was taught, in my limited education, was simply to have, say,
the people_id also appear in table2 as a Foreign Key, that tis would
serve to relate the tables. Now I've been advised that the way to do
this is NOT like that, but to have a third, linking, table where there
are 2 fields: one is the people_id (primary key from table1) and the
other is the machines_id (primary key from table2).
I was asking how to write a SQL statement to populate that third table
from the data already in/from the other 2.
Any other comments about this are welcome.
On Sunday, June 1, 2003, at 10:53 AM, Becoming Digital wrote:
> You need a constraint on the data to be inserted into the second
> table. Care to
> share what that is supposed to be?
> Edward Dudlik
> Becoming Digital
> ----- Original Message -----
> From: <trogers@stripped>
> To: <mysql@stripped>
> Sent: Sunday, 01 June, 2003 03:17
> Subject: Inserting data?
> I have a table, in the table is a field called name_id; in a second
> table (a linking table) I also have the field name_id, this should be
> the same/reference the same name_id as in the first table.
> The first table is fully populated. How do write a SQL statement to
> get the data from the name_id field of table1 into the name_id field of
> (I'll do this and find out after if it actually references the same
> data! So, if it doesn't at least I'll have learned the proper SQL
> statement. :)
> Thank you,
> Ted Rogers