It is given.
There is a table ' info ' in the database for 1000 lines.
It has columns: info_id , info_text , info_date (date format), and so on.

Task.
In the info_date column , update some of the values ​​with values ​​from the Excel table.

What am I doing.

  • I export the entire info table in the " csv " format.
  • I open this file in Google Doc (to solve the problem of UTF-8 encoding).
  • I insert (ctrl + c - ctrl + v) in the info_date column the desired date values.
    Save back to the " csv " file.
  • Then in MySqL I clean the info table from the data and import the edited " csv " file.

What is the problem.
In the info_date column , after importing the table, zero values ​​appear (DELTA) instead of the added dates.

Questions
1. How to insert data so that the date format of the column is saved in the "csv" file? (If at all possible).
2. Where to read about the transfer of data from Excel to the database?
3. How else can I transfer the data in an easy case? Can through merge of tables request Sql? Tell me, I can not figure it out.

PS At the request of attached screen date format. Date format - date

  • And look, in what format do you have the date in csv? - splash58
  • Date format - Date - Kanzafarov S.
  • This is in the database, but what does the date look like in the file that you import - splash58
  • Attached screen above. - Kanzafarov S.

1 answer 1

mysql has a function str_to_date (string, format), and you can use it when loading a csv file like this:

LOAD DATA INFILE 'имя_файла' INTO TABLE mytable (field1,@date,field3) SET date = STR_TO_DATE(@date, '%m/%d/%Y');