From: http://www.williamlong.info/info/archives/50.html
In a formal database environment, we often encounter this situation: the required data is not stored in the same data table. At this time, you need to use join.
Of course, how to combine the data of different databases depends on how you use it. There are four different Join methods, in this article, we will introduce you to inner
Multiple table joins are useful for establishing recordsets because in some cases we need to display the numeric data type as the corresponding text name, and this encounters the problem of creating a recordset for a multiple table join. For example, as a member registration system, a total of five tables, membership information Data sheet member, membership table memberidentity, membership rights table Memberlevel, membership category table Membersor
Label:Oracle outer JOIN (OUTER join)
Left OUTER join (the table on the left is unrestricted)
Right outer join (the table on the right is unrestricted)
All-out connection (both the left and right tables are unrestricted)
Corresponds to Sql:left/right/full OUTER
The (join) connections that are planned in the SQL standard are broadly grouped into the following four categories:
1. INNER JOIN: A join of a recordset that conforms to those records in which the join relationship exists in the two tables.
2. Outer coupling: It is divided into outer left coupling and outer right con
, ensure that there are the same number of expressions in the selection list of each joint query statement, and each query selection expression should have the same data type, or they can be automatically converted to the same data type. During automatic conversion, the system converts low-precision data types to high-precision data types.In Union statements that contain multiple queries, the execution sequence is from left to right. Brackets can be used to change the execution sequence. For exa
--Table Join join--Using subqueriesSelect Studentno,studentname, (select classname from Classes where Classid=student.classid) from Student--using the From multi-table methodSelect Student.studentno,student.studentname,classes.classnameFrom student,classeswhere student. Classid=classes. ClassIdORDER BY Student.studentno--Table inner/left/right join table on how t
Since this is the last one, you can't just list the dry standard statements, not to mention the table joins are also the more difficult part of SQL, so this collocation topic to elaborate table joins.How can we query the information of different tables together when we talk about the inefficiency of the related sub-queries in the previous blog post? This requires a table join.Unlike the previous union query, the Union combines different tables, that is, vertical joins, which are spelled upright.
Joins multiple table-built recordsets with INNER join syntax
Multiple table joins are useful for establishing recordsets because in some cases we need to display the numeric data type as the corresponding text name, and this encounters the problem of creating a recordset for a multiple table join. For example, as a member registration system, a total of five tables, membership information Data sheet member,
ObjectiveThis section begins with our join learning, about connecting this piece involves more content, we step by step learning, short content, in-depth understanding.Crossover join (Cross join)Cross joins are the simplest type of join. A cross join performs only one logica
The inner connection is divided into three kinds: equivalent connection, natural connection and unequal connection.The outer joins are divided into three types: Left outer join (either OUTER join or right join), and the outer join, or the all-inclusive (full OUTER join or co
Left Join/right Join/inner Join relatedA concluding remark about left and right connections:Left join the Where only shadow right table, right join where only affects the left table.Left JoinSELECT * from tbl1 left Join tbl2 where
Introduction to inner join and Outer Join and Their Applications
Inner join
Inner join should be the most common join method. It will only return records that comply with the join rules. Let's take a look at the syntax first.
Sele
of course join how to combine the data of different database, also depends on how you use it, there are four different ways of join, in this article we will introduce you Inner join and Outer join and its application.
In a formalized database environment, we often encounter this situation: the required information is
Oracle outer JOIN (OUTER join)
Left OUTER join (the table on the left is unrestricted)
Right outer join (the table on the right is unrestricted)
All-out connection (both the left and right tables are unrestricted)
Corresponds to Sql:left/right/full OUTER JOIN
Outer Join, left Outer Join
Definition: Used to query records that meet the connection conditions and do not meet the connection conditions.
Query emp table records
SELECT * FROM emp;Empno ename job mgr hiredate sal comm deptno1 7369 smith clerk 7902 800.00 202 7499 allen salesman 7698 1600.00 300.00 303 7521 ward salesman 7698 1250.00 500.00 304 7566 jones manager 7839 2975.00 205 7654 martin salesman 7698
This article mainly introduces data related to join and joinwith multi-table join queries in Yii2. it is very good and has reference value. if you need it, you can refer to the table structure below.
Currently, there are customer tables, order tables, book tables, and author tables,
Customer (id customer_name)Order table Order (id order_name customer_id book_id)Book table (id book_name author_id)Author tab
Left join and right join operations
Used to combine source table records when using the from clause.FromTable1[Left | right] JoinTable2OnTable1.Field1 CompoprTable2.Field2
Part
Description
Table1,Table 2
Record the name of the table to be combined.
Field1,Field2
The name of the joined field. These fields must have the same data type and contain the same data type, but the
Left Join/right Join/inner Join related
A word about the summary of the left and right connections:
Left JOIN to the right table, the right connection where only affects the left table.
Left Join
SELECT * from tbl1 left Join t
Oracle left join... ON... AND... and left join... ON... WHERE... difference about left join... on... and... and left join... on... the difference between where is that many online statements are about left join... on... and ..., and conditions only apply to associated fields
The following articles mainly describe the usage of MySQL left join, right join, and inner join) detailed analysis of the following articles is mainly to explain the actual operations in the form of an instance demonstration, the following is the detailed description of the article.
The following is an example
Table A records the following:
AID aNum
1 a200501
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.