Oracle Database SQL

Source: Internet
Author: User

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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.