SQL Fundamentals
Write a JOIN QueryEasyWrite Code
2/5
INNER JOIN

Description

Given two tables — `orders` and `customers` — write a query that returns each order alongside the customer's name and email. **Schema:**
sql
customers(id, name, email, created_at)
orders(id, customer_id, total, status, placed_at)
Your query should also include orders from the last 30 days only, sorted by most recent first.

Requirements

01Use an INNER JOIN between orders and customers on customer_id
02Select order id, total, status, customer name, and customer email
03Filter to orders placed within the last 30 days
04Order by placed_at descending

Example

-- Expected output columns:
-- order_id | total | status | customer_name | customer_email
-- 142      | 89.99 | shipped | Alice Chen   | alice@example.com
-- 139      | 24.50 | pending | Bob Park     | bob@example.com
Python 3
1
2
3
4
5
6
7
Ln 7, Col 1