Query records in Table A but not in table B.

Source: Internet
Author: User
Query records in Table A but not in table B.
    • Software environment:

        1. Windows NT4.0 + Oracle 8.0.4
        2. Oracle installation path: C: \ orant
  • Implementation Method:
    SQL> Create Table A (2 BM char (4), -- encoding 3 Mc varchar2 (20) -- name 4) 5/the table has been created. SQL> insert into a values ('20170301', '20160301'); SQL> INSERT INTO A values ('20160301', '20160301 '); SQL> insert into a values ('20170301', '20160301'); SQL> INSERT INTO A values ('20160301', '20160301 '); SQL> insert into a values ('20140901', '20160901'); SQL> Create Table B as select * from a where 1 = 2; the table has been created. SQL> insert into B values ('20170301', '20160301'); SQL> insert into B values ('20160301', '20160301 '); SQL> insert into B values ('20140901', '20160901'); SQL> insert into B values ('20160901', '20160901'); SQL> commit; completely submitted. SQL> select * From A; BM Mc ---- ------------------ 1111 11111112 11111113 11111114 11111115 1111sql> select * from B; BM Mc ---- -------------------- 1111 11111112 11111113 11111114 1111sql> select BM from a where not exists (select BM from B where. bm = B. BM); BM Mc ---- -------------------- 1115 1111

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.