0

I have a table like this in a text file:

AT1G02160.1 P38824  5e-04   2013_11
AT1G02210.1 O81913  2e-14   2013_11
AT1G02350.1 P55826  1e-09   2013_11
AT1G02610.1 F4JKK0  1e-08   2013_11
AT1G03580.1 Q84WU2  1e-06   2013_11
AT1G04330.1 Q6NN02  6e-13   2013_11

that I would like to import to a table in a database of mine in MySQL. First, I thought to introduce the last column, with value 2013_11, as a VARCHAR().However, In the end, it is a date (2013_11 means November 2013). So, I would like to add that field as a date in MySQL. I have done some research in Google, but I was not able to find anything useful to solve my problem.

Thanks in advance.

user2979409
  • 773
  • 1
  • 12
  • 23
  • possible duplicate of [How to change string date to MySQL date format at time of import of CSV using MySQL's LOAD DATA LOCAL INFILE](http://stackoverflow.com/questions/2238611/how-to-change-string-date-to-mysql-date-format-at-time-of-import-of-csv-using-my) – AeroX Jul 01 '14 at 16:14
  • Everything in a text file is a string - when you put it in a table of a database it takes on other meaning (integer, double, date, boolean, etc). So in your case you'd have to append an '_01' (or some other day value) to your text file. Then as AeroX stated, use LOAD data (after CREATE TABLE) to populate. Good luck. – user3741598 Jul 01 '14 at 16:29
  • Should I create the table, that column as `DATE`, then? What if I don't have days? – user2979409 Jul 01 '14 at 16:30
  • November 2013 is not a date. – shmosel Jul 01 '14 at 17:16
  • You haven't said what your problem is. – shmosel Jul 01 '14 at 17:17

0 Answers0