Skip to content

Instantly share code, notes, and snippets.

@KamiBG
KamiBG / Usage Funnels with Warby Parker SQL Practice
Created August 10, 2020 14:12
Analysing marketing funnels in order to calculate conversion rates. Codecademy SQL Project.
SELECT * FROM survey
LIMIT 10;
-- What is the number of responses for each question?
SELECT question, COUNT(response) FROM survey
GROUP BY question;
-- The questions 3. Which shapes do you like? and 5. When was your last eye exam? have lower completion rates (80% and 75% respectively). A possible reason might be people don't know which shape fits their face and don't remember when was their last eye exam.
-- Create a new table (structure of the new table is given):
@KamiBG
KamiBG / World Populations SQL Practice II
Created August 7, 2020 03:14
My solution to the codecademy's SQL practice (intermediate)
-- How many entries in the countries table are from Africa?
SELECT COUNT(id) FROM countries
WHERE continent = 'Africa';
--What was the total population of the continent of Oceania in 2005?
SELECT SUM(population) FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE population_years.year = 2005 AND countries.continent = 'Oceania';
SELECT * FROM met
LIMIT 10;
-- How many pieces are in the American Decorative Art collection?
SELECT COUNT(title) FROM met;
-- Count the number of pieces where the category includes ‘celery’.
SELECT DISTINCT category, COUNT(category) FROM met
WHERE category LIKE '%celery%';
@KamiBG
KamiBG / Hacker News SQL Practice
Created August 4, 2020 13:52
My solution to the intermediate SQL practice called " How to Hack Hacker News" on codecademy
SELECT * FROM hacker_news
LIMIT 20;
-- What are the top five stories with the highest scores?
SELECT title, score FROM hacker_news
ORDER BY score DESC
LIMIT 5;
-- Is a small percentage of Hacker News submitters taking the majority of the points?
SELECT user, SUM(score) FROM hacker_news
@KamiBG
KamiBG / Trends in Startups SQL Practice
Created August 4, 2020 11:50
My solution to the SQL practice (intermediate) Trends in Startups from codecademy.
@KamiBG
KamiBG / SQL Basic Practice
Last active August 4, 2020 03:24
A short SQL practice from codecademy (basic)
SELECT * FROM transaction_data
LIMIT 10;
-- full_names and emails of the transactions listing 20252 as the zip code:
SELECT full_name, email FROM transaction_data
WHERE zip = 20252;
-- Find names and emails associated with ‘Art Vandelay’ for full name or a ‘der’ for their middle name:
SELECT full_name, email FROM transaction_data
WHERE full_name = 'Art Vandelay' OR full_name LIKE '% der %';
@KamiBG
KamiBG / World Population SQL Practice
Last active August 4, 2020 03:24
This is codecademy's first SQL project (basics). The table is called "population_years" and has 3 columns ("country", "population", "year") and 2354 rows.
-- What years are covered by the dataset?
SELECT DISTINCT year FROM population_years;
-- What is the largest population size for Gabon in this dataset?
SELECT * FROM population_years
WHERE country = 'Gabon';
-- What were the 10 lowest population countries in 2005?
SELECT * FROM population_years
WHERE year = 2005