Skip to content

JOIN

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 Smith |
| 3 | Mary Johnson |

In the given example, the INNER JOIN keyword is used to select records that have matching values in both tables orders and customers. The SELECT statement returns the order_id from the orders table and the customer_name from the customers table.