使用 2 个合并列导入 sql

Import sql with 2 merged columns

您好,我收到了一个很大的 sql,需要导入到我的数据库中,共 9k 行。问题是结构不太一样。

table的header是:

Name,Bday,Email,Phone

我是这样收到的

INSERT INTO `Persons` (`Firstname`, `Lastname`, `Bday`, `Email`, `Phone`) VALUES 
('DRAGHICI', 'CLAUDIA', '1963-03-06', '', '0730010099'),
('CIMPEANU', 'ADRIAN GEORGE', '1975-03-06', '', '0747137312'),
('SIRBU', 'CRISTINA', '1985-05-17', '', '0726498751'),
('GHITA', 'DORU AURELIAN', '1962-04-20', '', '0722628325'),
('PALL', 'PETRISOR', '1980-06-24', '', '0745524485'),
('ZMARAND', 'MIHAELA', '1983-10-13', '', '23365646'),
('CHIRIAC', 'PETRE', '1948-04-26', '', '0745789651'),
('ZABAD', 'OMRAN MOHSEN', '1986-06-14', '', '0723368085'),
('TARA', 'SERGIU', '1974-12-01', '', '0722457299'),
('DRACULET', 'CLAUDIA OLIMPIA', '1978-01-22', '', '0745617755'),
('CINDEA', 'PETRISOR', '1970-01-17', '', '0351404534'),
('SAVESCU', 'ADRIANA MADALINA', '1980-09-12', 'madalina_savescu@yahoo.com', '0740699853'),
('POPA', 'SIMINA CLAUDIA', '1980-03-24', '', '0727 346126'),
('GHEORGHE', 'CONSTANTIN', '1986-02-04', '', '0760 244 833'),
('GEORGESCU', 'MARIETA', '1959-08-14', '', '0351422999'),
('SARBU', 'IULIAN', '1947-06-22', '', '0726565154'),
('CALAFETEANU', 'EMIL', '1954-03-20', '', '0745481772'),
('SURPATEANU', 'GEORGETA', '1952-01-26', '', '0743331284'),
('LIMBAN', 'DELIA MIHAELA', '1987-07-15', '', '222356'),
('MARCIU', 'ION', '1944-05-13', '', '0351407891'),

我需要将 firstname lastname 合并到列 name

创建一些其他的 Table

create table TempTable(FName varchar(100),
LName varchar(100),Bday datetime,Email varchar(30),Phone int)

然后插入这些值

insert into TempTable(FNamem,LName,Bday,Email,Phone)
-- 9 k rows

然后做这样的事情:

insert into OriginalTable (Name,Bday,Email,Phone)
select FNamem,LName,Bday,Email,Phone
from TempTable

按照@ganesh_devlekar 的建议进行操作,除了在上次查询中进行以下更改:

insert into OriginalTable (Name,Bday,Email,Phone)
select CONCAT(FNamem,' ',LName),Bday,Email,Phone
from TempTable