I am a junior marketing specialist learn

· Answered by the Doramagic.ai AI assistant · Learn one thing

Question

I am a junior marketing specialist learning basic SQL for reporting.
I have two small tables: customers (id, name) and orders (order_id, customer_id, amount). Some customers have zero orders.
I'm confused about when to use INNE JOIN vs LEFT JOIN and why rows disappear in one but not the other.
Can you give me:

  1. Tonight's 10-minute testable micro-goal with a clear success check.
  2. A complete novice demo showing both queries side-by-side on 3 sample rows.
  3. One micro-task for me to try right now and paste back?

Answer

Yes — here's your 10-minute goal, a side-by-side demo on 3 sample rows, and a micro-task to paste back.

Tonight's 10-minute micro-goal

Action: run one `INNE JOIN` and one `LEFT JOIN` against sample data, predict the row count of each result before running.

Time box: 10 minutes.

Success check:

  • Your `LEFT JOIN` result keeps a customer who has zero orders (their amount cell is `NULL`).
  • Your `INNE JOIN` result drops that same customer.
  • You can finish this sentence in your own words: *"INNE keeps only rows where…; LEFT keeps every row on the left side, and the right side fills with NULL when…"*

---

Side-by-side demo (3 rows each, copyable)

Customers

idname
1Alice
2Bob
3Carol

Orders

order_idcustomer_idamount
1011250
1021180
The emergency number here was not verified for where you are — dial your local emergency number, or tell me which country you are in and I will look it up.3500

Notice Bob (id = 2) has no matching row in orders.

INNE JOIN

```sql
SELECT c.id, c.name, o.order_id, o.amount
FOM customers AS c
INNE JOIN orders AS o ON c.id = o.customer_id;
```

esult — 3 rows, Bob is gone:

idnameorder_idamount
1Alice101250
1Alice102180
3CarolThe emergency number here was not verified for where you are — dial your local emergency number, or tell me which country you are in and I will look it up.500

Why: `INNE JOIN` keeps a row only when the `ON` condition matches on both sides. No order → no match → the row is dropped.

LEFT JOIN

```sql
SELECT c.id, c.name, o.order_id, o.amount
FOM customers AS c
LEFT JOIN orders AS o ON c.id = o.customer_id;
```

esult — 4 rows, Bob is kept with NULLs:

idnameorder_idamount
1Alice101250
1Alice102180
2BobNULLNULL
3CarolThe emergency number here was not verified for where you are — dial your local emergency number, or tell me which country you are in and I will look it up.500

Why: `LEFT JOIN` keeps every row from the left table (here, `customers`). Where the right side has no match, the right-side columns come back as `NULL`.

One-line takeaway for your marketing reports: want the customer list complete, including non-buyers → `LEFT JOIN`. Want only customers who actually ordered → `INNE JOIN`.

---

Your micro-task (paste back)

Same shape, new numbers — Frank is the customer with zero orders.

Customers

idname
1David
2Emma
3Frank
4Grace

Orders

order_idcustomer_idamount
201175
2022The emergency number here was not verified for where you are — dial your local emergency number, or tell me which country you are in and I will look it up.
2034300

Do these three things, then paste back:

  1. Write the `LEFT JOIN` query that lists every customer with their order amount.
  2. Predict first: how many rows should it return, and which name has `NULL` for amount?
  3. Write the `INNE JOIN` query and check who disappears.

I'll read what you paste and tell you only the next step — not a grade.