Oracle new data insert into finishing

Source: Internet
Author: User

A common method: INSERT into table name (Id,name,age,status, field N) VALUES (' id ', ' name ', ' age ', ' status ', ' field n '); --Suggest using this

Insert into table name values (column values);

Example: INSERT into User (Id,name,age,status,role) VALUES (' 1 ', ' xiaoming ', 23, 1, ' Group master ');

or insert into user values (' 1 ', ' xiaoming ', 23, 1, ' Group master ');

Second, from the table query convenient method: INSERT into table name (Id,name,age,status, field N) Select Id,name,age,status, field N from the name where id= ' id ';

Example: insert into user (Id,name,age,status,role) Select id,name,age,1, ' group master ' from location_user l where l.type=5;

Note: The query data must be a single piece of data

Three, small tricks

Primary key ID uniqueness, usually used in the background method (Java:uuid UUID = Uuid.randomuuid ();) insert

You can replace it with Sys_guid () later.

Example: insert into user (Id,name,age,status,role) Select Sys_guid (), name,age,1, ' group master ' fr  Om location_user l where l.type=5;

or INSERT into user (Id,name,age,status,role) VALUES (Sys_guid (), ' xiaoming ', 23, 1, ' Group master ');

Iv. Other database methods similar

  MySQL Database method: insert into user_t values (REPLACE (UUID (), '-', '), ' AA ', ' AA ', 22);

SQL Server database new data method: INSERT into user_t values (REPLACE (NewId (), '-', '), ' AA ', ' AA ', 22);

Oracle new data insert into finishing

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.