[Test @ ora1] SQL> select * From A; No. Name ---- ---------- 1000 Zhang San 2000 Li Si 3000 Wang Wu [test @ ora1] SQL> select * from B; product NO. ---- ---------- 1000 TV set 2000 video recorder 4000 bicycle [test @ ora1] SQL> set null Null Value -- Here I define null as [null value] [test @ ora1] SQL> select. *, B. * From a inner join B on. no. = B. no.; No. name No. Product ---- ---------- 1000 Zhang San 1000 TV set 2000 Li Si 2000 video recorder [
Nested loop join)
Loop nested join is the most basic link. As shown in its name, loop nesting is required. nested loop is the only method that supports inequality connection among the three methods, the process of this connection method can be simply described as follows:
Figure 1. Step 1 of loop nested join
Figure 2. Step 2 of loop nested
Http://www.blogjava.net/zolly/archive/2007/10/23/SQLJION.html
The join condition can be specified in the from or where clause. We recommend that you specify the join condition in the from clause. The where and having clauses can also contain search conditions to further filter the rows selected by the join conditions. Connections can be divided into the followin
--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:1, Cross join: There are two, explicit and implicit, without an ON clause, returns the product of two tables, also known as the Cartesian product, the number of returned records should be in a and B table in accordance with the record and. Explicit: SELECT [Cols_list] from aCross Joinb where [condition] implicit: SELECT [Cols_list] from a,b where [condition] 2, INNER join (INNER
Label:--Build Table Table1,table2:CREATE TABLE table1 (ID int,name varchar (10))CREATE TABLE table2 (ID int,score int)Insert INTO table1 Select 1,leeInsert INTO table1 Select 2,zhangInsert INTO table1 Select 4,wangInsert INTO table2 Select 1,90Insert INTO table2 Select 2,100Insert INTO table2 select 3,70such as table-------------------------------------------------Table1 | table2 |-------------------------------------------------ID Name |id Score |1 Lee | 90 |2 Zhang 100 |4 Wang |3 70 |---------
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
Inner join
There are two tables A and B.
The structure of Table A is as follows:
Aid: int; identifies the seed, primary key, and auto-increment ID
Aname: varchar
The data, that is, the records from select * From A, are shown in 1:
Figure 1: data in Table
Table B has the following structure:
Bid: int; identifies the seed, primary key, and auto-increment ID
Bnameid: int
Data, that is, the records from select * from B, are sh
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
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
, c.cat_name from Mingoods G, category C WHERE G. cat_id = c.cat_id; 2. Left join query ... on ... syntax : select a.filed, [A.filed2, .....,] b.filed, [b.filed4 ...,] from join L T;right table> as B on Suppose there is a, b two tables, the left connection query is a table on the left, B table on the right, A and B table through a relationship to correlate rows, B to match a table. 2.1 Take a loo
Let's start by looking at the results of the left join and the right join and the Inner join and the full join working on the table.
Create a new two table in the database and insert the data you want to test.
New table:[SQL]View PlainCopyUse [Test]GO/****** object: Table [dbo].[ EMP] Script Date: 06/22/2
Tags: http strong ar Data div sp on ad efLet's start by looking at the results of the left join and the right join and the Inner join and the full join working on the table.
Create a new two table in the database and insert the data you want to test.
New table:[SQL]Use [Test]
GO
/****** object: Table
Label:Transferred from: http://blog.csdn.net/jz20110918/article/details/41806611 Let's say we have two tables. Table A is the sheet on the left. Table B is the list on the right. Each of them has four records, of which two records name is the same, as follows: Let's look at the different joins
Table A
Id
Name
1
Pirate
2
Monkey
3
Ninja
4
Spaghetti
Differences between inner join, left JOIN, right join, outer join in SQLFor example, you'll know!Table A (A1,B1,C1) b (A2,B2)A1 B1 C1 A2 B201 Mathematics 95 01 Sheets Three02 Language 90 02 John Doe English Harry Select A.*, b.* from AINNER JOIN B on (A.A1=B.A2)The result is
Take a look at the results of the left join and the right join with the Inner join and the full join to manipulate the table.
Create a new two table in the database and insert the data you want to test.
New table:[SQL]View PlainCopy
Use [Test]
GO
/****** object: Table [dbo].[ EMP] Script Date: 06/
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
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.