User:Gopaleakshata

MYSQL(INNER JOIN)
Summary: in this tutorial, you will learn how to use MySQL INNER JOIN clause to select data from multiple tables based on join conditions.

Introducing MySQL   clause
The MySQL   clause matches rows in one table with rows in other tables and allows you to query rows that contain columns from both tables.

The   clause is an optional part of the   statement. It appears immediately after the   clause.

Before using the   clause, you have to specify the following criteria: The syntax of the   clause is as follows: Let’s simplify the syntax above by assuming that we are joining two tables   and  using the   clause. For each row in the   table, the   clause compares it with each row of the   table to check if both of them satisfy the join condition. When the join condition is met, the   will return a new row which consists of columns in both   and   tables.
 * First, the main table that appears in the   clause.
 * Second, the table that you want to join with the main table, which appears in the   clause. In theory, you can join a table with many other tables. However, for a better performance, you should limit the number of tables to join.
 * Third, the join condition or join predicate. The join condition appears after the  keyword of the   clause. The join condition is the rule for matching rows in the main table with the rows in the other tables.

Notice that the rows in both   and   tables have to be matched based on the join condition. If no match found, the query will return an empty result set. This logic is also applied when you join more than 2 tables.

The following Venn diagram illustrates how the   clause works. The rows in the result set must appear in both tables:   and   as shown in the intersection part of two circles.