--1.left Join left table is the primary table, left table returns all data, and the right table only returns data that matches the left table.Select T1.fpdm,t1.fphm, T1.ZJR,T1.ZJSJ,T1.ZJJX,T1.ZJJE,T1.ZFLX,T1.ZFID,T2.FPDM,T2.FPHM,T2.ZFLX from YW_ZJFPJL t1Left join XXDZMX T2 on t2.fpdm| | t2.fphm=t1.fpdm| | T1.fphmSelect T1.fpdm,t1.fphm, T1.ZJR,T1.ZJSJ,T1.ZJJX,T1.ZJJE,T1.ZFLX,T1.ZFID,T2.FPDM,T2.FPHM,T2.ZFLX f
Label:Simply and clearly, connect to the inner and outer links. Suppose there are two tables of A and B Internal connection: Inner JOIN indicates that the record of the AB table is displayed, excluding the condition of the AB table . There are three kinds of outer joins, that is, left OUTER joins, right connection, OUTER join, full OUTER join, the following is a
1 LEFT JOIN: The query results are based on the left table data. If the left table has four data, the right table has three data, the query result is four, and all the data in the left table.For example:EMP Table:Sal table:Left connection Select * from EMP left join SAL on
EMP. ename = SAL.ename; Left JOIN, the table EMP is the primary table, so the q
Tags: style blog c http a widthFor SQL joins, learning may be a bit confusing. We know that the join syntax for SQL has a lot of inner, outer, left, and sometimes it's not very clear what the result set looks like for a select. There is an article on Coding horror that explains the join of SQL through the Venn diagrams of the Venturi diagram. I feel clear and understandable, turn around.Let's say we have tw
Various joins in MySQL
1. Cartesian Product (cross join)
In MySQL, you can think of cross join or omit cross as join, or use ','
For example
Select * From Table1 cross join Table2
Select * From Table1 join Table2
Select * From Table1, Table2
Because the returned result is
Inner JOIN (equivalent connection) returns only rows that have the same join field in two tablesLeft join returns records containing all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that contain all the records in the right table and the same
Inner JOIN (equivalent connection) returns only rows that have the same join field in two tablesLeft join returns records containing all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that contain all the records in the right table and the same
Inner JOIN (equivalent connection) returns only rows that have the same join field in two tablesLeft join returns records containing all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that contain all the records in the right table and the same
Tags: style os using ar strong data SP Div ArtInner JOIN (equivalent connection) returns only rows that have the same join field in two tablesLeft join returns records containing all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that contain all the
INNER JOIN (equivalent join) returns only rows that have the same join field in two tablesLeft join returns records that include all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that include all records
INNER JOIN (equivalent join) returns only rows that have the same join field in two tablesLeft join returns records that include all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that include all records
INNER JOIN (equivalent join) returns only rows that have the same join field in two tablesLeft join returns records that include all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that include all records
Inner JOIN (equivalent connection) returns only rows that have the same join field in two tablesLeft join returns records containing all the records in the left table and the equivalent of the junction fields in the right tableRight join returns records that contain all the records in the right table and the same
In mysql, the left join, right join, and inner join queries are commonly used. But some friends know the differences between them, next I will introduce you to you.
LEFT JOIN
Two tables in the join relationship are displayed. After the data table on the left is joined, all d
I. Let's take a look at some of the simplest examples.
Example
TableAid adate1 a12 a23 a3
TableB
Bid bdate1 b12 b24 b4Two tables a and B are connected. fields with the same id must be retrieved.Select * from a inner join B on a. aid = B. bid this is only used to retrieve matching data.In this case, the following information is taken:1 a1 b12 a2 b2
Then left join refers:Select * from a left
I. Let's take a look at some of the simplest examples.
Example
TableAid adate1 A12 A23 A3
Tableb
Bid bdate1 B12 B24 B4Two tables A and B are connected. fields with the same ID must be retrieved.Select * from a inner join B on A. Aid = B. Bid this is only used to retrieve matching data.In this case, the following information is taken:1 A1 B12 A2 B2
Then left join refers:Select * from a left
Label: Inner JOIN (equivalent connection) returns only rows that have the same join field in two tables Left join returns records containing all the records in the left table and the equivalent of the junction fields in the right table Right join returns records that contain all the records in the right table and the s
Label:First borrow the official explanation under:Inner JOIN (equivalent connection): Returns only rows with the same junction field in two tables;Left join: Returns records that include all records in the left table and the equivalent of the junction fields in the right table;Right join: Returns records that include all records in the right table and the junctio
Label: INNER JOIN (equivalent join) returns only rows that have the same join field in two tables Left join returns records that include all the records in the left table and the equivalent of the junction fields in the right table Right join returns records that include all
In the relational database management system, the relationship between data does not have to be determined when a table is created, and all information about an object is often stored in a table. When retrieving data, you can use the join operation to query information about different entities in multiple tables. Connection operations bring great flexibility to users. They can add new data types at any time. Create new tables for different entities an
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.