Skip to content

ON

SELECT orders.order_id, customers.customer_name
FROM orders
INNER JOIN customers ON orders.customer_id = customers.customer_id;
+---------+---------------+
| order_id| customer_name |
+---------+---------------+
| 1 | John Doe |
| 2 | Jane Doe |
+---------+---------------+

This SQL statement performs an INNER JOIN between the orders table and the customers table where the customer_id of both tables match. The result is a new table that shows the order_id from the orders table and the customer_name from the customers table for each matching customer_id.