The INNER JOIN keyword selects all rows from both tables as there should be match between the columns in both tables.
SQL INNER JOIN Syntax
SELECT column_name
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
or , we can say
SELECT column_name
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
Below is a selection from the "Customers" table:
|
Below is a selection from the "Customers" table:
| |||||||||||||||||||||||||||||||||||||||||||
And a selection from the
"Orders" table:
|
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
The
INNER JOIN keyword selects all rows from both tables as there is a match between the columns. If there
are rows in the "Customers" table that matches in "Orders", these customers
will be listed and the rows in the
customer table that does not match with
the order table will not be listed .

0 comments:
Post a Comment