Italian Trulli

Inner Joins In SQL With Example

Test Tribe
.
Inner Joins In SQL With Example 

SQL Inner Joins
SQL inner joins also known as EQUIJOINS. SQL joins Keyword selects all records that have matching values in both tables. In another word, we can say that Inner join is used to Return records that have matching values in both tables. 

Syntax of SQL Inner Joins 
The basic syntax of inner joins is as follows.

SELECT table1.column1, table2.column2... 
FROM table1 INNER JOIN table2 
ON table1.common_field = table2.common_field;
Note: We can also write JOIN instead of INNER JOIN. JOIN is the same as INNER JOIN.

Example of SQL Inner Joins

SELECT customers.customer_id, orders.order_id
FROM customers
INNER JOIN orders
ON customers.customer_id = orders.customer_id;

In this example, we are selecting the customer ID and order ID from two tables: "customers" and "orders". The "ON" clause specifies the condition for the join, which in this case is that the customer ID in the "customers" table must match the customer ID in the "orders" table.

The result of this query will be a table with two columns: customer_id and order_id, showing only the rows where there is a match between the two tables based on the customer_id column.

Inner joins are useful when you need to combine data from multiple tables that have matching values in a specific column, and you only want to see the rows where there is a match between the tables.

How to use Inner Joins in SQL with Example.

Hope !!! The above tutorial on inner join in SQL with examples is helpful for you...

Team,
QA acharya

Inner Joins in SQL With Example
 

Post a Comment

0 Comments