English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The INNER JOIN command returns rows with matching values from both tables.
The following SQL selects all orders with customer information:
SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
Note:If there are matching items between the columns, the INNER JOIN keyword will select all rows from the two tables. If there are records in the 'Orders' table that do not match with the 'Customers' table, these orders will not be displayed!
The following SQL statement selects all orders that contain customer (CustomerID) and shipper (ShipperID) information:
SELECT Orders.OrderID, Customers.CustomerName, Shippers.ShipperName FROM ((Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID); INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID);