SQL
Performing an INNER JOIN Between Two Tables
Learn how to combine rows from two tables based on a related column using an INNER JOIN. This fundamental SQL operation retrieves matching records from both tables efficiently.
SELECT
o.order_id,
o.order_date,
c.customer_name,
c.customer_email
FROM
Orders o
INNER JOIN
Customers c ON o.customer_id = c.customer_id
WHERE
o.order_date >= '2023-01-01';
How it works: This SQL snippet demonstrates the use of an `INNER JOIN` to combine data from the 'Orders' table and the 'Customers' table. It links rows from both tables where the `customer_id` column matches. The `WHERE` clause then filters these combined results to show only orders placed on or after January 1, 2023, providing a clear example of retrieving related data from multiple sources.