Skip to content

Instantly share code, notes, and snippets.

View nguyenhaison183's full-sized avatar
🏠
Working from home

Nguyen Hai Son nguyenhaison183

🏠
Working from home
  • HCMC Vietnam
  • 09:25 (UTC +07:00)
View GitHub Profile
@nguyenhaison183
nguyenhaison183 / interview_prep_problems.txt
Last active January 14, 2021 17:49
Project: Interview prep problems | Codecademy | Analyze data with SQL | 9. Interview prep | Interview Prep
-- CODE CHALLENGE 1
-- Select the title, author, and average_rating of each book with an average_rating between 3.5 and 4.5.
SELECT
title,
author,
average_rating
FROM books
WHERE average_rating BETWEEN 3.5 AND 4.5;
@nguyenhaison183
nguyenhaison183 / climate_change.txt
Created January 14, 2021 10:03
Project: Climate change | Codecademy | Analyze data with SQL | 7. Advanced SQL | Windows Functions
-- Let’s see what our table contains
SELECT *
FROM state_climate
WHERE state = 'Alabama'
LIMIT 5;
-- How the average temperature changes over time in each state.
SELECT
@nguyenhaison183
nguyenhaison183 / attribution_query.txt
Created January 11, 2021 05:18
Project: Attribution queries | Codecademy | Analyze data with SQL | 6. Analyze real data with SQL | Marketing attribution
/*
Here's the first-touch query, in case you need it
*/
WITH first_touch AS (
SELECT user_id,
MIN(timestamp) as first_touch_at
FROM page_visits
GROUP BY user_id),
ft_attr AS
(
@nguyenhaison183
nguyenhaison183 / DavieBurgers_subway_ad.txt
Created January 10, 2021 17:14
Project: Davie's Burgers Subway Ad | Codecademy | Analyze data with SQL | 2. Writing basic queries | Extra practice
SELECT *
FROM orders
LIMIT 10;
SELECT DISTINCT order_date
FROM orders;
SELECT special_instructions
FROM orders
LIMIT 20;
@nguyenhaison183
nguyenhaison183 / RPA_customer_segmentation.txt
Created January 10, 2021 16:58
Project: RPA Customer Segmentation | Codecademy | Analyze data with SQL | 2. Writing basic queries | Extra practice
SELECT *
FROM users
LIMIT 20;
SELECT email, birthday
FROM users
WHERE birthday BETWEEN '1980-01-01' AND '1989-12-31';
SELECT email, created_at
FROM users
@nguyenhaison183
nguyenhaison183 / RPA_fraud_detection.txt
Last active January 10, 2021 16:58
Project: RPA Fraud Detection | Codecademy | Analyze data with SQL | 2. Writing basic queries | Extra practice
SELECT *
FROM transaction_data
LIMIT 10;
SELECT full_name, email, zip
FROM transaction_data
WHERE zip = 20252;
SELECT full_name, email
FROM transaction_data
@nguyenhaison183
nguyenhaison183 / NY_restaurant.txt
Last active April 19, 2024 09:26
Project: New York restaurant | Codecademy | Analyze data with SQL | 2. Writing Basic Queries | Queries
SELECT *
FROM nomnom;
SELECT DISTINCT neighborhood
FROM nomnom;
SELECT DISTINCT cuisine
FROM nomnom;
SELECT *
@nguyenhaison183
nguyenhaison183 / create_a_table.txt
Last active April 19, 2024 08:11
Project: Create a table | Codecademy | Analyze data with SQL | 1. Getting started with SQL | Manipulation
CREATE TABLE friends (
id INTEGER,
name TEXT,
birthday DATE
);
INSERT INTO friends
VALUES (1, 'Jane Doe', 1990-05-30);
SELECT *
@nguyenhaison183
nguyenhaison183 / funnels_WarbyParker.txt
Last active January 10, 2021 16:45
Project: Usage funnels with Warby Parker | Codecademy | Analyze data with SQL | 6. Analyze Real Data with SQL | Usage funnels
WITH
MONTHS AS
(
SELECT
'2017-01-01' AS FIRST_DATE,
'2017-01-31' AS LAST_DATE
UNION
SELECT
'2017-02-01' AS FIRST_DATE,
'2017-02-29' AS LAST_dATE