1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Rep Power

    what is the fastest way to import a lot of data in my database? I could use the LOAD DATA INFILE - statement but as far as i understand it this way i could only import data in one table!

    I have six tables and all are connected (primary key of table a is also saved in table b and so on).

    So what could i do? Do i have to use C/Perl/PHP?

    Thanks for your ideas!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 1999
    Rep Power
    In MySQL, there is no physical connection between tables (i.e. pointers), relations are a logical concept. So if you have 6 files of tab delimited records, you can just import each one of them into your database. Then you use C/Perl/PHP to define the relations to use when querying.

    This is assuming that the data already contains the id numbers that each table uses to connect to the others. If your record ids are built using auto-increments, you'll have to write some scripts that load one of the files, then query the whole thing and build the next table.

  4. #3
  5. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Niagara Falls (On the wrong side of the gorge)
    Rep Power
    Another option you may consider:

    Most SQL compliant engines offer an SQL dump that exports table structure and data as SQL CREATE and INSERT statements.

    e.g. in mysql you could do this (from the command line)

    mysqldump -u user -ppassword database > /path/to/where/you/want/dump.sql

    Then to import to mysql:

    mysql -u user -ppassword database < /path/to/dump.sql

    Note that you have to create the database first.

    So check the docs for the SQL engine you are using to see if it supports a dump.

Similar Threads

  1. Transfer xml data from VB6 server to Excel2003 (client)
    By tmarko in forum Visual Basic Programming
    Replies: 0
    Last Post: January 22nd, 2004, 06:21 PM
  2. Replies: 0
    Last Post: August 13th, 2003, 04:18 AM
  3. Replies: 1
    Last Post: August 3rd, 2003, 05:22 AM
  4. How to Add data to existing data in database
    By sandjak in forum PHP Development
    Replies: 2
    Last Post: November 19th, 2001, 07:13 PM
  5. Dumping MySQL Data for Import to Excel
    By chinook in forum MySQL Help
    Replies: 2
    Last Post: November 2nd, 2001, 12:53 PM

IMN logo majestic logo threadwatch logo seochat tools logo