SQL statement optimization: optimization of JOIN, LEFT JOIN and RIGHT JOIN statements; sqljoin
In database applications, we often need to perform multi-table queries on the database. However, when the data volume is large, multi-table queries have a huge impact on the execution efficiency, therefore, pay special attention to the use of
Merge data using relational algebra1 relational algebraThe theoretical basis of Data Set merging is relational algebra, which was proposed by E. F. codd in 1970.In the formal language of relational algebra:? Tables or data sets are used to represent links or entities.? Use rows to represent tuples.? Columns are used to represent attributes.Relational algebra contains the following eight Relational operators? Select to return the rows that meet the specified conditions.? Projection: returns the s
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
Oracle connections are divided into the following types:Inner join ).Outer Join: Full join, left join, and right join ).Cross join ).
The outer join is different from the inner
Left JOIN, Inner join related content, very practical, for understanding the principle and specific applications are very helpful! The LEFT join is a shorthand for the left outer join, and the left join defaults to the outer property. The Inner
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
Within SQL Server, three types of inner join operations are implemented, and most people have never heard of these connection types since they are not logical connections and are rarely used in code. So when are they going to be used? The answer depends on the situation. This means that you have to rely on recordsets and indexes. The query optimizer always chooses the optimal physical connection type intelligently. We know that the SQL optimizer creat
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: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 junc
Tags: find php yourself join where difference intersection from HTMTransfer from http://www.phpddt.com/db/inner_join-outer-join.html The 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 u
Reprint Address: http://www.phpddt.com/db/inner_join-outer-join.html respect for the work of others is to respect their own achievements!The 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
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
An Introduction to left join, right join and full join in oracle is from oracle ocp9i document: outer join syntax: 1) you use an outer join to also see rows that do not meet the join condition 2) the outer
Label:The 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 defects is inner join, in addition, The LEFT
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
Chat with a friend today and talk about a small problem in their company. As follows:
Table A equipment table, storage MAC address, province, city, district.Table B software table, store MAC address, software name.The function is to query the list of software by province, city, or district.
What do you think it does now?It obtains the MAC address through the province, the city, or the district, then inquires the B table to use in the query.
It is obviously unreasonable to deal with this many-
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.