Create automatically table that is composed by its primery key and 2 other foreign keys
Posted
by user210481
on Stack Overflow
See other posts from Stack Overflow
or by user210481
Published on 2010-03-12T10:47:30Z
Indexed on
2010/03/12
10:57 UTC
Read the original article
Hit count: 418
mysql
|foreign-keys
I have table A with a primary id, a table B with a primary key id also and another table C with a primary key id and rows Aid and Bid where Aid and Bid are foreign keys of C and the primary keys of A and B respectively.
One way of populating these DB would be populating table A, table B and table C separately.
I would like to know if there is a more clever way of doing it, where I could populate A first and at the same time I populate B, I can indicate that an entry in C should be also created.
Any idea and suggestion on how to populate them is welcome. I'm trying to take advantage of the foreign keys structure
Thanks
© Stack Overflow or respective owner