MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 28th, 2000, 01:59 PM
chr1701 chr1701 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 11 chr1701 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,

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!
Chris.

Reply With Quote
  #2  
Old May 3rd, 2000, 12:22 PM
donarb donarb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 1999
Location: Seattle
Posts: 133 donarb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
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.

Don

Reply With Quote
  #3  
Old May 3rd, 2000, 02:40 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Fastest way to import data


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway