{"id":31322800,"url":"https://github.com/pedropalmier/8-week-sql-challenge","last_synced_at":"2026-05-16T18:03:12.572Z","repository":{"id":312444106,"uuid":"1047476859","full_name":"pedropalmier/8-week-sql-challenge","owner":"pedropalmier","description":"My solutions for the 8 Week SQL Challenge, answering business problems using PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-09-23T14:53:33.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-23T16:32:47.655Z","etag":null,"topics":["postgres","postgresql","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedropalmier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-30T14:06:17.000Z","updated_at":"2025-09-23T14:53:36.000Z","dependencies_parsed_at":"2025-08-30T18:27:14.481Z","dependency_job_id":null,"html_url":"https://github.com/pedropalmier/8-week-sql-challenge","commit_stats":null,"previous_names":["pedropalmier/8-week-sql-challenge-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pedropalmier/8-week-sql-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropalmier%2F8-week-sql-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropalmier%2F8-week-sql-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropalmier%2F8-week-sql-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropalmier%2F8-week-sql-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedropalmier","download_url":"https://codeload.github.com/pedropalmier/8-week-sql-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedropalmier%2F8-week-sql-challenge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276966877,"owners_count":25736888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgres","postgresql","sql","sqlite"],"created_at":"2025-09-25T19:15:40.555Z","updated_at":"2026-05-16T18:03:12.566Z","avatar_url":"https://github.com/pedropalmier.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔥🗓️ 8 Week SQL Challenge\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_master_pedropalmier.png\" width=100% height=100%\u003e\u003c/p\u003e\n\n\n👋  Hi! This repository contains my solutions for the [8 Week SQL Challenge](https://8weeksqlchallenge.com/), featuring **140+ business problems** to be solved using SQL, covering customer segmentation, churn analysis, and financial reporting across e-commerce, subscription services, and fintech industries.\n\n***If you found it useful, consider giving it a*** ⭐️ ***!***\n\n---\n\n### 🎯 Why I Took This Challenge\nI completed this challenge to enhance my data querying and analysis skills, becoming a more autonomous Product Manager in data-driven decision making.\n\n\n### ⚡️ SQL Skills \u0026 Features Applied\nThrough these progressively complex cases, I developed proficiency in the following SQL skills and techniques:\n\n| SQL Skill / Feature | Syntax Examples |\n|:------------------|:----------------|\n| Advanced Analysis | `PERCENTILE_CONT()`, `PERCENTILE_DISC()`, *Moving Averages* |\n| Aggregate Functions | `SUM()`, `COUNT()`, `AVG()`, `MIN()`, `MAX()` , `GROUP BY`|\n| Conditional Statements | `CASE WHEN ... THEN ... ELSE ... END` |\n| Complex Joins | `INNER JOIN`, `LEFT JOIN`, `RIGHT JOIN`, *Self Joins* |\n| Conditional Aggregation | `SUM(CASE WHEN ... THEN 1 ELSE 0 END)` |\n| Core Query Structure | `SELECT`, `FROM`, `ORDER BY`, `LIMIT` |\n| CTEs \u0026 Subqueries | `WITH cte_name AS (...)`, `FROM (SELECT… FROM…)` |\n| Data Manipulation \u0026 Unnesting | `INSERT`, `UPDATE`, `DELETE`, `CREATE TABLE`, `UNNEST()` |\n| Data Type Conversion | `::INT`, `::DATE`, `CAST()` |\n| Date Functions | `DATE_TRUNC()`, `EXTRACT()`, `MAKE_DATE()`, `TO_CHAR()` |\n| Generate Series | `GENERATE_SERIES()` |\n| Lag/Lead Functions | `LAG()`, `LEAD()` |\n| Mathematical Functions | `ROUND()`, `CEIL()`, `FLOOR()`, `STDDEV_SAMP()` |\n| Null Handling | `COALESCE()`, `NULLIF()`, `IS NULL`, `IS NOT NULL` |\n| Primary \u0026 Foreign Keys | `ADD CONSTRAINT pk_name PRIMARY KEY`, `FOREIGN KEY` |\n| Ranking Functions | `RANK()`, `DENSE_RANK()`, `ROW_NUMBER()` |\n| Regular Expressions | `REGEXP_REPLACE()` |\n| Row \u0026 Aggregate Filtering | `WHERE`, `HAVING` | \n| String \u0026 Array Functions | `TRIM()`, `CONCAT()`, `STRING_TO_ARRAY()`, `REGEXP_REPLACE()` |\n| Union Operations | `UNION ALL`, `UNION` |\n| Window Functions | `OVER (PARTITION BY ... ORDER BY ...)` |\n\n### 🧰 Environment Setup \nFor these exercises, I chose PostgreSQL as it has been the most popular DBMS for the second consecutive year, according to the [2024 Stack Overflow Developer Survey](https://survey.stackoverflow.co/2024/technology#1-databases:~:text=PostgreSQL%20debuted%20in%20the%20developer%20survey%20in%202018%20when%2033%25%20of%20developers%20reported%20using%20it%2C). This reinforces my SQL skills while staying aligned with industry standards and current trends.\n\nAdditionally, I used [DataGrip](https://www.jetbrains.com/datagrip/) as my database IDE and set up the provided databases on a local PostgreSQL server to simulate a more realistic environment, rather than using the sandbox [DB Fiddle](https://www.db-fiddle.com/f/2rM8RAnq7h5LLDTzZiRWcd/138) environment provided by the case author.\n\n### 🙌 Special thanks to\n[@MarianaMannes](https://github.com/marianamannes), my friend and former colleague, for pointing me to these exercises when I said I wanted to sharpen my SQL skills. [@DannyMa](https://github.com/datawithdanny) for creating such well-designed cases. And the [DataGrip](https://www.jetbrains.com/datagrip/) team for generously extending my trial license so I could work on the exercises with their awesome tool.\n\n### 💡 Before You Start\nFeel free to copy or adapt my answers — they’re meant to be shared.  If you notice a mistake or want to discuss any solution, I’d be happy to hear from you at ola@pedropalmier.com.\n\n# 🏃🏻‍♂️‍➡️ Case Studies \u0026 My Solutions\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case01_dannys_diner\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_dannys_diner.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case02_pizza_runner\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_pizza_runner.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case03_foodie_fi\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_foodie_fi.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case04_data_bank\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_data_bank.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case05_data_mart\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_data_mart.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case06_clique_bait\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_clique_bait.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case07_balanced_tree\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_balanced_tree.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\u003ca href=\"https://github.com/pedropalmier/8-week-sql-challenge/tree/0f1f4789f34b8a66a92c261162b1ed588591c812/case08_fresh_segments\"\u003e\u003cimg src=\"https://default-pedro.s3.us-east-2.amazonaws.com/8weekschallenge/hero_images/hero_fresh_segments.png\"  style=\"width:50%; height:50%;\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\n---\n© ***Pedro Palmier** • September 2025*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedropalmier%2F8-week-sql-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedropalmier%2F8-week-sql-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedropalmier%2F8-week-sql-challenge/lists"}