Tags: Connection Method field name comparison field record right outer connection outer JOIN mode use 1-- inner connection: INNER JOIN It represents a matching record that returns two tables or Recordset join fields, representing the portions
of the two tables that are contained in each other 2 Select * from Inner Join
The following is a 137-row SQL statement. If you understand this, I want to know about left join and inner join. (My personal opinion only)
The following is a piece of code:
Select num1, num2, num3, num4, num5, num6, num7, num8, num9, num10, area. areacode, area. areaname, num11
From(Select area_code areacode, area_name areaname, Fa. grade_path grade, Fa. IDFrom
Assume that the following table is used:
One is the voting master table, and the other is the voter information table ~ Record the IP address of the voter and the corresponding voting type. The left-right connection is actually the result of our joint query. Which table prevails ~1: for example, right join or right outer join:Take the voter table on the right as the standard. The record in the
2016-6-12 22:35:51Working for more than a year of Oracle, recently learning MySQL, think carefully about the various connections, feel these concepts are quite annoying! Recently organized a bit, share their own understanding, some things are borrowed from the Internet and absorbed by themselves.1. No matter what the connection is, the principle of Oracle and MySQL is exactly the same, but some of the wording is different. Speaking of writing, here's a little bit.SELECT * from A, B where a.filed
Recently, the company is recruiting people. My colleagues asked a few questions about database connection that I think the database can be applied ~Now I want to write about their functions here.Assume that the following table is used:One is the voting master table, and the other is the voter information table ~ Record the IP address of the voter and the corresponding voting type. The left-right connection is actually the result of our joint query. Wh
Inner join, full outer join, left join, right jionCombination of inner join tablesFull outer is connected to the same combination of two tables. Table A has data that table B does not have (it is displayed as null), and table B hasTable A does not display (null)Table A
: FULL OUTER JOIN ).Select o. ID, O. ORDER_NUMBER, O. CUSTOMER_ID, C. ID, C. NAMEFrom orders o full outer join MERs c on c. ID = O. CUSTOMER_ID;Note: MySQL does not support all external connections. The method provided here is suitable for Oracle and DB2. However, you can obtain the query results of the all outer connections through the
follow the join condition after ON, and write the conditions for the central table to the WHERE clause.Statement 9: FULL OUTER JOIN ).Select o. ID, O. ORDER_NUMBER, O. CUSTOMER_ID, C. ID, C. NAMEFrom orders o full outer join mers c on c. ID = O. CUSTOMER_ID;Note: MySQL does not support all external connections. the method provided here is suitable for Oracle and
table to the WHERE clause.
Statement 9: Full outer join ).Select O. ID, O. order_number, O. customer_id, C. ID, C. NameFrom orders o full outer join MERs C on C. ID = O. customer_id;Note: MySQL does not support all external connections. The method provided here is suitable for Oracle and DB2. However, you can obtain the query results of the all outer connections
connection, the corresponding column values of the two tables are the same in the result set, with multiple column names in parentheses to require a comma connection, the column name must be the same select * from Tb_test1 Cross join Tb_student using (ID); MySQL only! : (No full outer connection in MySQL, implemented with union) Join=inner Join=cross
Original link: http://www.powerxing.com/sql-join/In general, the use/difference of four joins can be described as:
The LEFT join returns all records from the table (shop), even if there are no matching rows in the right table (Sale_detail).
Right outer join, returns all records in the right table, even if
Tags: strong internal connection target HTTP intermediate NAT condition ref dataOne, internal connection-inner jion: SELECT * FROM table1 INNER JOIN table2 on table1.field1 compopr table2.field2 The INNER JOIN operation can be divided into the following sections: Section description Table1, Table2 records the name of the table being combined. Field1, field2 the name of the field being joined. If they are no
Tags: Right connection between select str notation GES data result connectionThe following lists the JOIN types that you can use, and the differences between them.
JOIN: Returns a row if there is at least one match in the table (Join=inner join)
Left
Label:SQL table join query (inner JOIN, full join, left JOIN, right join) Prerequisites: Suppose there are two tables, one is the student table and the other is the Student score table. The table data are: One, int
Label:SQL table join query (inner JOIN, full join, left JOIN, right join) Prerequisites: Suppose there are two tables, one is the student table and the other is the Student score table. The table data are: One, internal con
SQL table join query (inner join, full join, left join, right join)
Prerequisites: Assume that there are two tables, one is the student table and the other is the student renewal table.
Table data includes:
I. inne
Label:Prerequisites: Suppose there are two tables, one is the student table and the other is the Student score table. The table data are: One, internal connection-inner jion: The most common connection query may be that of identifying the student's name and score: Select S.name,m.mark from student S,mark m where S.id=m.studentid The above is our most common inner join, that is, within the connection, the student.id=mark.studentid conditions of the
1 common table connections (inner join,left join,right join,full Join,cross join)if object_id(N'table1'N'U') is not NULL Drop Tabletable1if object_id(N'table2'N'U') is not NULL Drop Tabletable2Create TableTable1 (IDint, na
statement:SELECT Persons.lastname, Persons.firstname, Orders.ordernofrom Persons on INNER JOIN Orders persons.id_p = Orders.id_porder by Persons.lastnameResult set:
LastName
FirstName
OrderNo
Adams
John
22456
Adams
John
24562
Carter
Thomas
77895
Carter
Thomas
44678
Different SQL JOINIn addition to the INNER
, you can use keyword join to get data from two tables If you want to list everyone's subscriptions, you can use the following SELECT statement SELECT Persons.lastname, Persons.firstname, Orders.orderno from
Persons
INNER JOIN Orders on
persons.id_p = Orders.id_p
ORDER by Persons.lastname
Result set:
LastName
FirstName
OrderNo
Adams
John
22456
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.