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!

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.