Skip to content

Instantly share code, notes, and snippets.

@codecademydev

codecademydev/project.sqlite Secret

Created Feb 19, 2020
Embed
What would you like to do?
Codecademy export
--most common types of purchase made
SELECT DISTINCT product_id, COUNT (*) AS count_pi
FROM purchase
GROUP BY 1
ORDER BY 2;
SELECT DISTINCT style, COUNT (*) AS count_st
FROM purchase
GROUP BY 1
ORDER BY 2;
SELECT DISTINCT model_name, COUNT (*) AS count_mn
FROM purchase
GROUP BY 1
ORDER BY 2;
SELECT DISTINCT color, COUNT (*) AS count_c
FROM purchase
GROUP BY 1
ORDER BY 2;
SELECT DISTINCT price, COUNT (*) AS count_pr
FROM purchase
GROUP BY 1
ORDER BY 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment