MySQL multi-table query (Cartesian product principle)
Note: It is best to use table aliases to distinguish column names. Cartesian Product Demo: Left, right, inner, outer joins Inner join: Important: All matching records are returned. select * from a,b where ax = bx ////Inner join l There are two types of outer joins: left join and right join. Key points: All matching records are returned plus one record for each row where the primary table foreign key value is null. All columns of the auxiliary table are null values. select * from a left join b on ax=bx order by ax //Left outer join or left join select * from a right join b on ax=bx order by ax //Right outer join or right join Select clause order
This concludes this article on how to use the Cartesian product principle in MySQL to perform multi-table queries. For more information about MySQL multi-table queries, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of Linux rpm and yum commands and usage
>>: Detailed tutorial on installing MariaDB on CentOS 8
MySQL View the maximum number of connections and ...
Table of contents 1. Introduction to PXC 1.1 Intr...
Since Alibaba Cloud's import of custom Ubuntu...
This article uses examples to explain the princip...
This article describes how to build a MySQL maste...
Modify the simplified file size and download the ...
mysql efficient query MySQL sacrifices group by t...
1. Storage Engine In the last section, we mention...
one. Overview of IE8 Compatibility View <br /&...
When the front-end and back-end interact, sometim...
There are many commands used in the system, so ho...
Tomcat defines multiple ClassLoaders internally s...
There are two situations 1. Start time and end ti...
【question】 The INSERT statement is one of the mos...
question Nginx takes $remote_addr as the real IP ...