Oracle Multi-Table Association update

Source: Internet
Author: User

CREATE TABLE T1 (
ID Number (10),
Name VARCHAR2 (10)
);
CREATE TABLE T2 (
ID Number (10),
Name VARCHAR2 (10)
);

INSERT into T1 values (1, ' 06 ');
INSERT into T1 values (2, ' 02 ');
INSERT into T2 values (3, ' 03 ');
INSERT into T2 values (1, ' 01 ');

SELECT * from T1;
select * from T2;

Update T1
Set t1.name = (select T2.name from T2 where t2.id=t1.id)
where exists (select * from T2 where t2.id=t1.id);

Oracle Multi-Table Association update

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