Detailed explanation of mysql exists and not exists examples tableA |column1 | column1 | column3 | tableb |column1 | column1 | column3 | To query the data of tableA, the condition is that tableA.column1 is not in tableB.column2 of tableB That is to say, you want to get an effect similar to the following statement (the effect of not in is not completely equivalent to not exists. If there is an empty record in the subquery, the entire query statement will not return data) SELECT a.* FROM table A WHERE a.column1 not in ( SELECT column2 FROM tableB ) This can be achieved using the following statement SELECT a.* FROM table A WHERE NOT EXISTS( SELECT b.column2 FROM tableB b WHERE a.column1=b.column2 ) The above is only the case of two tables. In fact, it is also easy to use in the connection query of multiple tables. The above writing method also applies to exists The above is a detailed example of MySQL exists and not exists. If you have any questions, please leave a message or discuss in the community of this site. Thank you for reading and hope to help everyone. Thank you for your support of this site! You may also be interested in:
|
<<: Linux loading vmlinux debugging
>>: jQuery implements the practice of changing the position and size of div by dragging the mouse
Effect principle Mainly use CSS gradient to achie...
Table of contents Why use a debugger? Basic usage...
Table of contents Preface InnoDB storage architec...
Table of contents question extend Solving the pro...
Solution 1 Completely uninstall and delete all da...
Two examples of the use of the a tag in HTML post...
Preface In today's increasingly convenient In...
Copy table structure and its data The following s...
As the Internet era becomes more mature, the deve...
stat function and stat command Explanation of [in...
Table of contents Why do we need a material libra...
This article example shares the specific code of ...
Table of contents Table definition auto-increment...
Table of contents Installing the SDK Managing loc...
When using Dreamweaver or FrontPage to create HTM...