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
Left JOIN
will have two tables left or right in the join relationship. The left table after the "join", regardless of whether there is the right table data corresponding to the data, will still be all listed, the relevant examples are as follows:The legacy where"join syntax represents the" left
In the talk of MySQL before the join grammar or the first review of the coupling of the grammar, oh, in fact, even I have forgotten almost, then we go over it together (if the content has errors or doubt, the domestic information on the MySQL connection is very small, I believe that after reading this article, we will have a fairly clear understanding of the MySQL connection syntax, and will not be confused by the external connection of Oracle ("+").T
Preface: Do not sum up and forget it!
Let's give a general explanation first.
Example Table
Aid
Adate
1
A1
2
A2
3
A3
Table B
Bid
Bdate
1
B1
2
B2
4
B4
Problem: two tables A and B are connected and fields with the same ID must be retrieved.
Select * from a inner join B on A. Aid = B. Bid this is to retrieve only matching data.
Label:Left join the left JOIN, That is, the meaning of the left outer join is that the data in the table that restricts the right end of the connection keyword must satisfy the join condition , and the contents of the left-hand table are output if the data in the table in the left side satisfies the
This section describes table join, more specifically inner joins internal join.Only two records matching each other are selected for the internal join. Therefore, sometimes the records we need are not included.To better understand this concept, we will introduce two tables for demonstration. Party and MSP in the Scottish Parliament ).
Party (Code, name, leader)Code: political partyCodeName: name of a poli
1. Theory
As long as the public fields of the two tables have matched values, the records in the two tables are combined.
My personal understanding: Use a common field to calculate the intersection of the two tables that meet the requirements, and combine the records that meet the requirements of each table with the common fields.
Syntax
From Table1 inner join Table2 on Table1. field1 compopr Table2. field2
The inner
1. Theory
As long as the public fields of the two tables have matched values, the records in the two tables are combined.
My personal understanding: Use a common field to calculate the intersection of the two tables that meet the requirements, and combine the records that meet the requirements of each table with the common fields.
Syntax
From Table1 inner join Table2 on Table1. field1 compopr Table2. field2
The inner
SQL left join, right join, and inner join
Today, I chatted with a friend about a small problem in their company. As follows:
Table A device table stores MAC addresses, provinces, cities, and zones.Table B Software Table, which stores MAC addresses and software names.You can query the Software List by province, city, or district.
Guess how it works now?
It obtains
Tags: assigning local data comparison operator mem Quick object Pop resultINNER 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
The following articles mainly describe the table connection statements for Oracle Outer join and cross join. Oracle database connections include the inner join statements) oracle Outer join, full join), left join), right
Union of SQL statements, join of intersection (inner join, Outer Join), cross join Cartesian Product, difference set (not in)
1.A. UnionSelect column1, column2 from Table1UnionSelect column1, column2 from Table2
B. Intersection joinSelect * From Table1 as a join Table2 B
Tags: www. POS nbsp Join table data Intersection case tagThe difference between inner join, outer join, and Cross join in SQL many people do not know, I also ask, just look for information to look at, with their previous understanding, if you use join table, the case of defe
First, take a look at some of the simplest examples.
Example
Table AAid Adate1 A12 A23 A3
TableB
Bid Bdate1 B12 B24 B4Two table a,b connected, to remove fields with the same IDSELECT * from a INNER join B on a.aid = B.bid This is the only matching data to be fetched.At this point, the removal is:1 A1 B12 A2 B2
So the left join means:SELECT * from a LEFT join
Label: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 table Right join returns records that include all r
INNER JOIN ( equivalent connection ) returns only rows in which the junction fields are equal in two tablesLeft join ( left Join ) returns records that include all records in the left table and the equivalent of the junction fields in the right tableRight join ( right Join )
In-depth introduction to SQL left join, right join, and full join
We introduced table join, more specifically inner joins internal join. Only two records matching each other are selected for the internal join. Therefore, somet
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.