K
If all columns in the first table are textual, then a function can be used to change the line at the date, for example https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_str-to-date the second parameter indicating the appropriate https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format for sausage %d.%m.%Y %h:%i:%s It's quite appropriate for your case.I hope that the example will be clear: http://sqlfiddle.com/#!9/d8ee1/4 MySQL 5.6 Schema Setup:create table t1 (s varchar (100), d varchar (100), t varchar (100));
create table t2 (s varchar (100), d varchar (100), data date, vremja time, data_i_vremja datetime);
insert into t1 values ("строка1", "ещё строка1", "27.06.2015 8:53:07"),
("строка2", "ещё строка2", "27.06.2015 11:48:57");
insert into t2 (s, d, data, vremja, data_i_vremja)
select t1.s, t1.d,
str_to_date (t1.t, "%d.%m.%Y %h:%i:%s"),
str_to_date (t1.t, "%d.%m.%Y %h:%i:%s"),
str_to_date (t1.t, "%d.%m.%Y %h:%i:%s")
from t1;
Query 1:select * from t1
http://sqlfiddle.com/#!9/d8ee1/4/0 :| s | d | t |
|---------|-------------|---------------------|
| строка1 | ещё строка1 | 27.06.2015 8:53:07 |
| строка2 | ещё строка2 | 27.06.2015 11:48:57 |
Query 2:select t1.s, t1.d, str_to_date (t1.t, "%d.%m.%Y %h:%i:%s") as data from t1
http://sqlfiddle.com/#!9/d8ee1/4/1 :| s | d | data |
|---------|-------------|------------------------|
| строка1 | ещё строка1 | June, 27 2015 08:53:07 |
| строка2 | ещё строка2 | June, 27 2015 11:48:57 |
Query 3:select * from t2
http://sqlfiddle.com/#!9/d8ee1/4/2 :| s | d | data | vremja | data_i_vremja |
|---------|-------------|------------------------|---------------------------|------------------------|
| строка1 | ещё строка1 | June, 27 2015 00:00:00 | January, 01 1970 08:53:07 | June, 27 2015 08:53:07 |
| строка2 | ещё строка2 | June, 27 2015 00:00:00 | January, 01 1970 11:48:57 | June, 27 2015 11:48:57 |