Lost in Warby Parker Exercise

I’ve been working through this module for hours. Seriously, HOURS! So I can use a hand on this. I tried using the “Hint,” but I don’t even understand that.

The instructions where I am say:
Use a LEFT JOIN to combine the three tables, starting with the top of the funnel (quiz) and ending with the bottom of the funnel (purchase).

I know I was off in where my code is. I was just trying to connect things. My thinking was here:

The hint though, threw me a curve ball. Here’s what it says:

SELECT DISTINCT q.user_id,
h.user_id IS NOT NULL AS ‘is_home_try_on’,
h.number_of_pairs,
p.user_id IS NOT NULL AS ‘is_purchase’
FROM quiz q
LEFT JOIN home_try_on h
ON q.user_id = h.user_id
LEFT JOIN purchase p
ON p.user_id = q.user_id
LIMIT 10;

Here’s my issue right now: I have no idea how we got to letters h, p, q, or how they came up with those. I thought maybe the letters matched up with where the letters were on each of the three tables, but the letters don’t match. I know there’s something I’m doing wrong, I just don’t know what it is.

:grimacing:

Please help. Send brain.

UPDATE:
I think I figured it out. The query defines an alias/variable for each table (i.e. “FROM quiz q” so that quiz=q) and then uses those same variables in the SELECT section. I’m not sure if I had seen this in a previous exercise, but I think that’s what I couldn’t figure out. I’ll leave this question here for a while to see if anyone has comments or corrections.

CC had a nicely laid out sheet for different kinds of JOINs – not sure if that is still included. The articles section has some explanations and examples as well.