inner join
An inner join is a type of join operation in relational database management systems (RDBMS) that returns only the matching rows between two or more tables. It combines rows from two or more tables based on a related column between them, known as a join condition.
The result of an inner join includes only the rows where the join condition is satisfied. In other words, it returns the intersection of the records from the joined tables.
Here is an example of an inner join:
Table A: ID | Name ----|----- 1 | John 2 | Mary 3 | David
Table B: ID | Age ----|---- 1 | 25 3 | 32 4 | 40
Inner Join: SELECT TableA.ID, TableA.Name, TableB.Age FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID
Result: ID | Name | Age ----|-------|---- 1 | John | 25 3 | David | 32
In this example, the inner join returns only the matching rows from Table A and Table B based on the common ID column. The row with ID 2 is excluded from the result because it does not have a matching ID in Table B.
Inner joins are commonly used to combine related data from multiple tables in a database query. They can be used to retrieve data that is distributed across different tables and provide a way to connect and retrieve relevant information from those tables
原文地址: https://www.cveoy.top/t/topic/hLNE 著作权归作者所有。请勿转载和采集!