0

I have a local file named UpdateTable.csv that looks like this:

Chromosome  ProbeCount  TranscriptCount

   chr1       84453         2887
   chr10      32012         1087
   chr11      49780         1721
   chr12      39723         1402

...etc

I just created a table, named "SUMMARY" that has the same row titles. I need to import the file into my table from my desktop..

Thank you for your help!

2 Answers 2

1

You can use Load data infile

Read more here: http://dev.mysql.com/doc/refman/5.6/en/load-data.html

In your situation, something like:

LOAD DATA INFILE 'c:/users/USER_NAME/Desktop/file.csv'
    INTO TABLE summary
    FIELDS terminated by "\t"
    LINES terminated by "\r\n"

Of course, this SQL is only an example. Please read the manual.

Sign up to request clarification or add additional context in comments.

1 Comment

I updated the answer to the latest version of the docs. This is a very helpful feature of MySQL. +1
0
mysqlimport [options] db_name textfile1 [textfile2 ...]

For each text file named on the command line, mysqlimport strips any extension from the file name and uses the result to determine the name of the table into which to import the file's contents. For example, files named patient.txt, patient.text, and patient all would be imported into a table named patient.

So in your case, you would have to change your file name from UpdateTable.csv to SUMMARY.csv and remove the first two lines of that file. It would something like

mysqlimport --fields-escaped-by=, db_name SUMMARY.csv

**EDIT acutally one a second look, your file is not a csv (Comma Separated ...). Your file is tab separated and thus the argument for fields escaped by should be '\t'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.