Query IDs that do not exist in the Database

Source: Internet
Author: User


Query the IDs that do not exist in the Database. Suppose your database has A table A: www.2cto.com ID NAME1 aaa2 bbb3 ccc4 ddd requirement: How many IDs do you need to return the IDs that do not exist in Table? The following code returns. 1.,. select id from A where A. ID in. 2. now we use an SQL statement: www.2cto.com SQL code select B. id from (select 1 as id from dual union select 2 as id from dual union select 8 as id from dual union select 9 as id from dual) B left join A on. id = B. id where. id is null;

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.