Home > Database > Mysql Tutorial > body text

Recommended articles about inner join queries

零下一度
Release: 2017-06-13 10:45:08
Original
1731 people have browsed it

1. Use union and union all to merge the two query results: select field name from tablename1 union select field name from tablename2; note that this operation must ensure that the fields in the two tables are the same and the field data types are also the same. In addition, when using union, duplicate (identical) records will be removed, but union all will not. Note: The following join queries involve the concept of Cartesian product, that is, if there are two tables, the first one has n records, and the other table has m records, then the Cartesian product The number of records is n*m; if the number of fields in the first table is a and the number of fields in the other table is b, then the number of fields obtained by the Cartesian product is a+b. 2. Use natural join: The premise is that the two tables have the same fields: (This operation will remove duplicate fields) For this query, my understanding is: keep the associated fields (such as department_id here) in these two tables. data, remove the data that only exists in one table: as shown in the above content, there are four pieces of data in company, and e

1. mysql common basic operation syntax (8)~~Multiple table query Merge results and inner join query [command line mode]

Recommended articles about inner join queries

Introduction: 1. Use union to merge two Query results: select field name from tablename1 union select field name from tablename2; note that this operation must ensure that the fields in the two tables are the same and the field data types are also the same. Note: The following join queries involve the concept of Cartesian product, that is, if there are two tables, the first one has n records, and the other table has m records, then the Cartesian product The number of records is n*m; if the number of fields in the first table is a and the number of fields in the other table is

2. Query of database series (5 )

Introduction: Inner join 1 Syntax SELECT column name FROM Table 1 INNER JOIN Table 2 ON Table 1. Column name condition operator Table 2. Column name [WHERE condition] [ORDER BY sorting column] Among them, ON Table 1. Column name conditional operator Table 2. Column name, the commonly used conditional operators are: =,. Table 1. Column names and Table 2. Column names are the common columns of the two tables respectively. The inner join query produces two numbers

3. mysql-MySQL inner join query result display order

Recommended articles about inner join queries

Introduction: The field f_id of the table fruits is the primary key![](http://img.ask.csdn.net/upload/201503/29/1427613666_237884.jpg) The field s_id of the table suppliers is the primary key and has the same data type as the s_id of fruits![](http://img.ask.csdn.net/upload/201503/29/1427613692_645959.jpg) Then use this query statement: 1. select suppliers.s_i...

The above is the detailed content of Recommended articles about inner join queries. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template