Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 16, 2020 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/dd6e0dcdc69f2430260a5deae695d2c1 to your computer and use it in GitHub Desktop.
Save codecademydev/dd6e0dcdc69f2430260a5deae695d2c1 to your computer and use it in GitHub Desktop.
Codecademy export
SELECT *
FROM survey
LIMIT 10;
SELECT question,
COUNT(DISTINCT user_id)
FROM survey
GROUP BY question;
SELECT question,
COUNT(DISTINCT user_id)
FROM survey
GROUP BY 1;
SELECT *
FROM quiz
LIMIT 5;
SELECT *
FROM home_try_on
LIMIT 5;
SELECT *
FROM purchase
LIMIT 5;
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;
@elmulix
Copy link

elmulix commented Aug 17, 2020

Thanks for sharing!
I´ve got the same code as you.
Keep on sharing.

Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment