|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I'm quite new to mysql, and though I have read quite thuroughly several different books, and a number of tutorials, one thing
continues to escape me. Since we can "join" data from multiple tables for display purposes, can't we do essentially the reverse? Given the Normalization Process, it's necessary to break a database down into smaller tables, each "interconnected" via id's etc.. Were my question comes in, is when go to insert data into those tables, obviously from one form.. what's the approach there? Is there a method for inserting data into multiple tables in one fail swoop? instead of doing them one by one? Any information on this, live tutorials, etc.. would be very very helpful.. this seems to be the only confusion I have at this point.. well.. not exactly the other one is sorta wrapped into that one, and it deals with "incrementing" the row identifiers between tables, since it appears that only one column in a table can be "auto incremented".. so I'm a little lost on that aspect of it.. after all a table may contain multiple id fields, one for it's rows, and one or more which links it to other tables/rows. ------------------ SnR Graphics, Low Cost Hosting and Web Development. |
|
#2
|
|||
|
|||
|
Short answer: no.
You can't insert to multiple tables in one statement. Also, why would you have more than 1 auto_increment field, they'd essentially contain the same value unless you specifically set one to a higher value at some point, in which case they'd have the same offset. When you need to include an id from another table you have to get the id from that table. |
|
#3
|
|||
|
|||
|
You know, all of a sudden I feel pretty much like an idiot URL
Just reading your post really turned on the light bulb. All this time for some damn reason, I was thinking that each table would be getting new data each time a user say completed a form. But due to normalization that wouldn't be the case, since for example a table for "states" would already be a complete table, the associated states ID would be "added" to the user information, etc... -------------------------------------------- But.. I am still not completely sure how I would approach something like putting a usersname/password to one table, and all his information into another table, I mean they would surely need to be linked somehow? wouldn't there need to be a linking 'id' fields between those two tables? Or would we just assume that entry would be sequential and the '1' id field would serve to 'join'? --------------------------------------------- ------------------ SnR Graphics, Low Cost Hosting and Web Development. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > INSERTING DATA TO MULTIPLE TABLES |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|