Jump to content

Simple MySQL Data question, just need a push in the right direction


idontknowphp

Recommended Posts

What is the best way to insert a large amount of data? I am talking like 1000+pages of text...

 

i know insert is a starting point, I figured since it is for search purposes i can remove all the special characters and insert it.

 

which brings up another (related) question...

 

Say i want to insert into only certain columns that have a volume number of say 29...how would i build my query?

 

I am assuming i need to use an insert and select together but i cant quite figure it out.

 

Thanks in advance!

Thanks so much, I will work on figuring it out! I am a noob so i never even heard of that before...

 

edit: Ok so i think that this will work well:

 

LOAD DATA INFILE 'thefile.txt' INTO TABLE the_table (col1);

 

But how can i structure it to only load into only those rows where there is a certain criteria, e.g. "only insert into col1 if col2=20"

not trying to bump, updating progress....i sat down and did some pseudo code brainstorming...i think this might work and i cant believe it didn't occur to me earlier...but is there an easier way?

 

Here is the pseudo code i came up with

If the value of 'col2' is equal to '20'
    LOAD DATA INFILE 'thefile.txt' INTO TABLE the_table (col1)
else
      Do nothing

 

in other words, could a simple if statement or even a while loop work for the application? i will be populating the DB with the same data in some instances is why i ask...

ok, so make a new table and use it for test purposes? then when it is correct, transfer it over?

 

Sorry, I must sound like an idiot to you, but i have only minimal time with the language so i know next to nothing, just really basic data accessing and so forth.

ok, so make a new table and use it for test purposes? then when it is correct, transfer it over?

 

Sorry, I must sound like an idiot to you, but i have only minimal time with the language so i know next to nothing, just really basic data accessing and so forth.

Yup, that's the right idea.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.