#1
  1. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    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. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    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.
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    You know, all of a sudden I feel pretty much like an idiot

    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.

Similar Threads

  1. <THEAD> not printing across multiple pages
    By allanmcc in forum HTML Programming
    Replies: 2
    Last Post: September 29th, 2003, 08:47 PM
  2. grabbing data from multiple tables
    By sherdog in forum MySQL Help
    Replies: 1
    Last Post: August 7th, 2003, 04:29 AM
  3. Inserting data into multiple tables with Join
    By weirdity in forum MySQL Help
    Replies: 0
    Last Post: June 27th, 2000, 01:30 PM
  4. Inserting into Multiple Dbs and Tables - possible?
    By localads in forum MySQL Help
    Replies: 1
    Last Post: January 11th, 2000, 03:12 AM
  5. Replies: 2
    Last Post: November 18th, 1999, 11:08 AM

IMN logo majestic logo threadwatch logo seochat tools logo