AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL Inner Join |
SQL > SQL JOIN >
Inner Join
An inner join in SQL returns rows where there is at least one match on both tables. Let's assume that we have the following two tables, Table Store_Information
Table Geography
We want to find out sales by store, and we only want to see stores with sales listed in the result set. To do this, we can use the following SQL statement using INNER JOIN: SELECT A1.Store_Name STORE, SUM(A2.Sales) SALES
FROM Geography A1 INNER JOIN Store_Information A2 ON A1.Store_Name = A2.Store_Name GROUP BY A1.Store_Name; Result:
By using INNER JOIN, the result shows 3 stores, even though we are selecting from the Geography table, which has 4 rows. The row "New York" is not selected because it is not present in the Store_Information table.
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.