Today, when I sorted out the project implementation documents that I used to work with an older generation, I found a SQL statement that is quite cool. I 'd like to share it with you:
-- The structure of the sample table is identical to that of the sample_clone table.
Insert into sample (name, address, phonenumber) values ('A', 'wuhan. hubei', '2017 );
Insert into sample (name, address, phonenumber) values ('bb ', 'wuhan. hubei', '123 ');
Insert into sample (name, address, phonenumber) values ('cc', 'wuhan. hubei', '123 ');
Insert into sample (name, address, phonenumber) values ('dd', 'wuhan. hubei', '123 ');
-- Use the query result as the updated content
Insert into sample_clone (name, address, phonenumber) Select name, address, phonenumber from sample
-- Generate a specific update statement
Select distinct 'insert into sample_clone (name, address, phonenumber) values (''ee '', ''wuhan. hubei '', ''' | phonenumber | '''); 'from sample where name = 'dd'
-- Generate update statements in batches
Select 'insert into sample_clone (name, address, phonenumber) values ('ee '', ''wuhan. hubei '', ''' | phonenumber | '''); 'from sample
I would like to express my silent reverence for the years and my longing for the elders in this article...