Skip to content

INNER

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID;
+-----------------+---------+
| CustomerName | OrderID |
+-----------------+---------+
| Alfreds | 10308 |
| Ana Trujillo | 10365 |
| Antonio Moreno | 10355 |
| Antonio Moreno | 10383 |
| Around the Horn | 10355 |
| Berglunds snabbköp | 10384 |
+-----------------+---------+

The SQL INNER JOIN keyword selects records that have matching values in both tables. In the example provided, it retrieves a list of customer names and their corresponding order IDs from the ‘Customers’ and ‘Orders’ tables where the ‘CustomerID’ in both tables are the same.