Learn about difference between inner join and outer join, we have the largest and most updated difference between inner join and outer join information on alibabacloud.com
Tags: description database table selection No related detailed associated demo postFirst, let's look at some of the simplest examples. Example Table AAid Adate1 A12 A23 A3 TableB Bid Bdate1 B12 B24 B4Two tables A, B connected, to remove fields with the same IDSELECT * from a INNER join B on a.aid = B.bid This is only the matching data is taken out.At this point, the removal is:1 A1 B12 A2 B2Then the left
Description:Obviously, only a.aid = B.bid records are shown here. This shows that inner join is not based on who, it only shows records that match the criteria.The left JOIN operation is used in any FROM clause,The record of the combined source table. Use the left JOIN operation to create an
Description:Obviously, only a.aid = B.bid records are shown here. This shows that inner join is not based on who, it only shows records that match the criteria.The left JOIN operation is used in any FROM clause,The record of the combined source table. Use the left JOIN operation to create an
20060324034 a20050114 4 2006032404Result Description:Obviously, only a.aid = B.bid records are shown here. This shows that inner join is not based on who, it only shows records that match the criteria.The left JOIN operation is used in any FROM clause,The record of the combined source table. Use the left JOIN operatio
inner join is not based on who, it only shows records that match the criteria.--------------------------------------------Note:The left JOIN operation is used to combine records from the source table in any from clause. Use the left JOIN operation to create an outer
For example:
Hive> select * From zz0;111111222222888888Hive> select * From zz1;111111333333444444888888
Hive> select * From zz0 join zz1 on zz0.uid = zz1.uid;111111 111111888888 888888Hive> select * From zz0 left Outer Join zz1 on zz0.uid = zz1.uid;111111 111111222222 null888888 888888Hive> select * From zz0 right Outer
anum bID bname 1 a20050111 1 2006032401 2 a20050112 2 2006032402 3 a20050113 3 2006032403 4 a20050114 4 2006032404 Result Description: Obviously, here Only a record of A.aid = B.bid is displayed. This shows that the inner join is not based on who, it only shows the records that match the criteria. —————————————— – Note: The LEFT JOIN operation is use
S.sno, Sname, S. Dname, S.cno, MARK, TnameFrom STUDENT as SINNER JOIN TEACHER as TOn S. dnameand S. CNO =t. CNOORDER BY Sname
The results of the operation are shown in Figure 9.14.
Figure 9.14 Query results with unequal connections
Describes that by default, a DBMS executes a multiple-table query by pressing INNER JOIN
is not based on who, it only shows records that match the criteria.--------------------------------------------Note:The left JOIN operation is used to combine records from the source table in any from clause. Use the left JOIN operation to create an outer join of the side. The left
that inner join is not based on who, it only shows records that match the criteria.--------------------------------------------Note:The left JOIN operation is used to combine records from the source table in any from clause. Use the left JOIN operation to create an outer
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
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
Tags: connecting left connection Ali data sheet full join left and right out combination case connections in SQL can be divided into inner joins, outer joins, and cross connections. 1. Cross join Without a WHERE clause, it will return the Cartesian product of the two tables connected, and the number of rows returning
bname1 a20050111 1 20060324012 a20050112 2 20060324023 a20050113 3 20060324034 a20050114 4 2006032404Null null 8 2006032408(The number of affected rows is 5)
Result description:After careful observation, we will find that the result of left join is exactly the opposite. This time, it is based on the right table (B) and is filled with null when table A is insufficient.
3. Inner joinThe SQL statement is a
Left join returns records that include all records in the left table and join fields in the right table.Right join returns records that include all records in the right table and the joined fields in the left table.Inner join (equivalent join) returns only rows with equal
081219
-- Retrieve the public part
Select * From t_goods a inner join t_storein BOnA.Gid = B.GID
-- All the tables on the right are retrieved, and the tables on the left are matched.
Select * From t_goods a right join t_storein BOnA.Gid = B.GID
-- Retrieve all tables on the left and matched tables on the right
Select * From t_goods a left
left join is exactly the opposite, this time it is based on the right table (B), where a table is not enough to fill with null. 4. Inner Join Example: 4.1Select * from A inner join B on a.aid = B.bid; This shows only the records of A.aid = B.bid. This shows that
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.