SQL Projects for All Levels: Beginner to Advanced Portfolio Guide
Stand out to hiring managers with these 6 real-world SQL projects for beginner, intermediate, and advanced data analysts with datasets and code.
When hiring managers review hundreds of data analyst resumes, generic coursework certificates and toy projects (like Titanic survival or Iris flower classification) blend into background noise. To secure interview invitations at competitive tech firms, you need tangible SQL projects that prove you can extract messy data, answer ambiguous executive questions, and write scalable queries.
In this guide, we outline 6 production-grade SQL projects structured across beginner, intermediate, and advanced levels, complete with recommended public datasets, key business questions, and runnable query templates.
Why Real SQL Projects Matter for Data Careers
In a technical interview, hiring managers do not test whether you memorized syntax; they test whether you think like a business analyst. High-impact SQL projects prove five vital capabilities:
- Business Metric Fluency: Translating ambiguous concepts like "customer engagement" into concrete SQL calculations (DAU/MAU ratios, churn rates).
- Defensive Query Writing: Guarding against data traps like row duplication from non-unique joins and division-by-zero errors.
- Advanced Analytical Logic: Utilizing Common Table Expressions (CTEs), window functions, and conditional aggregation.
- Reproducibility: Organizing clean, well-commented SQL scripts in a public GitHub repository.
Hiring Manager Tip
Never just upload a loose .sql file to GitHub. Include a markdown README.md containing: The Business Problem, The Schema Diagram (ERD), The Key Query Insights, and Business Recommendations.
Tier 1: Beginner SQL Projects (Foundations & Exploratory Analysis)
These projects establish core competency in multi-table JOIN operations, aggregate grouping, and conditional data categorization.
Project 1: E-Commerce Sales & Customer Demographics Explorer
- Dataset: Olist Brazilian E-Commerce Dataset (100,000 real orders across 9 relational tables).
- Core Concepts:
INNER JOIN,LEFT JOIN,GROUP BY,HAVING,CASE WHEN. - Key Business Questions:
- Which product categories generate the highest gross merchandise value (GMV)?
- How do customer delivery lead times correlate with five-star vs one-star customer review scores?
- What percentage of orders originate from top tier cities versus rural regions?
-- Sample Query: Average delivery delay and review score by product category
SELECT
p.product_category_name,
COUNT(o.order_id) AS total_orders,
ROUND(AVG(EXTRACT(DAY FROM (o.order_delivered_customer_date - o.order_estimated_delivery_date))), 1) AS avg_delay_days,
ROUND(AVG(r.review_score), 2) AS avg_customer_rating
FROM orders o
JOIN order_items oi ON o.order_id = oi.order_id
JOIN products p ON oi.product_id = p.product_id
JOIN order_reviews r ON o.order_id = r.order_id
WHERE o.order_status = 'delivered'
GROUP BY p.product_category_name
HAVING COUNT(o.order_id) >= 100
ORDER BY avg_customer_rating ASC;Tier 2: Intermediate SQL Projects (Cohorts, Churn & BI Pipelines)
Intermediate SQL projects showcase advanced analytical capabilities that mirror daily data analyst responsibilities.
Project 2: SaaS Subscription MRR & Customer Churn Analysis
- Dataset: Synthetic Stripe Billing or Telco Customer Churn Dataset.
- Core Concepts: Common Table Expressions (
WITH), Window Functions (LAG,LEAD,ROW_NUMBER), Date Truncation. - Key Business Questions:
- What is the Monthly Recurring Revenue (MRR) expansion vs contraction breakdown?
- What is the 30-day, 60-day, and 90-day subscription churn rate by plan tier?
- Which billing frequencies (monthly vs annual) exhibit the lowest churn probability?
-- Sample Query: Month-over-Month Net MRR Churn
WITH monthly_billing AS (
SELECT
DATE_TRUNC('month', payment_date)::DATE AS billing_month,
customer_id,
SUM(amount) AS monthly_spend
FROM subscription_payments
GROUP BY 1, 2
),
mrr_summary AS (
SELECT
billing_month,
SUM(monthly_spend) AS total_mrr,
LAG(SUM(monthly_spend), 1) OVER (ORDER BY billing_month) AS prior_mrr
FROM monthly_billing
GROUP BY billing_month
)
SELECT
billing_month,
total_mrr,
prior_mrr,
ROUND((total_mrr - prior_mrr) * 100.0 / NULLIF(prior_mrr, 0), 2) AS mrr_growth_pct
FROM mrr_summary;Project 3: Marketing Multi-Touch Attribution Modeling
- Dataset: Web analytics event log with UTM parameters and transaction conversions.
- Core Concepts:
FIRST_VALUE,LAST_VALUE, Window Frames,DENSE_RANK. - Key Business Questions:
- How does First-Touch attribution compare against Last-Touch and Linear attribution models?
- Which paid acquisition channels deliver the highest Return on Ad Spend (ROAS)?
For more details on ranking queries, see our tutorial on the SQL rank function.
Tier 3: Advanced SQL Projects (Warehousing & Performance Optimization)
Advanced projects demonstrate data engineering integration, data modeling, and performance optimization.
Project 4: Full-Stack Analytical Warehouse with dbt & PostgreSQL
- Dataset: Healthcare records (MIMIC-IV clinical database) or Financial Transaction Logs.
- Core Concepts: Normalization in SQL, DDL commands in SQL, Star Schema modeling (Facts vs Dimensions), Index tuning with
EXPLAIN ANALYZE. - Deliverables: A complete dbt project with automated staging, intermediate, and dimensional mart models, data tests, and documentation.
| Feature / Criteria |
|---|
End-to-End SQL Project Walkthrough: E-Commerce RFM Customer Segmentation
To illustrate how senior analysts architect portfolio-grade sql projects, here is a complete production query pattern implementing RFM (Recency, Frequency, Monetary) segmentation on transactional data. Explore our complete SQL Tutorials hub for more scenario templates.
-- Production RFM Customer Segmentation Model
WITH CustomerBase AS (
SELECT
customer_id,
-- Recency: Days since last order relative to fixed benchmark date
DATE_PART('day', '2026-09-08'::timestamp - MAX(order_date)) AS recency_days,
-- Frequency: Total count of completed orders
COUNT(DISTINCT order_id) AS frequency_count,
-- Monetary: Total gross spend
SUM(order_amount) AS monetary_value
FROM fact_orders
WHERE order_status = 'Completed'
GROUP BY customer_id
),
RFMScores AS (
SELECT
customer_id,
recency_days,
frequency_count,
monetary_value,
-- Score 1 (worst) to 5 (best) using NTILE quartiles
NTILE(5) OVER (ORDER BY recency_days DESC) AS r_score,
NTILE(5) OVER (ORDER BY frequency_count ASC) AS f_score,
NTILE(5) OVER (ORDER BY monetary_value ASC) AS m_score
FROM CustomerBase
)
SELECT
customer_id,
recency_days,
frequency_count,
monetary_value,
(r_score || f_score || m_score) AS rfm_cell,
CASE
WHEN r_score >= 4 AND f_score >= 4 AND m_score >= 4 THEN 'Champions'
WHEN r_score >= 3 AND f_score >= 3 THEN 'Loyal Customers'
WHEN r_score >= 4 AND f_score = 1 THEN 'Recent New Customers'
WHEN r_score <= 2 AND f_score >= 3 THEN 'At Risk / Need Attention'
WHEN r_score = 1 AND f_score = 1 THEN 'Lost Customers'
ELSE 'Potential Loyalist'
END AS customer_segment
FROM RFMScores
ORDER BY monetary_value DESC;This single query showcases CTE modularity, date math, windowed quantiles (NTILE), conditional CASE statements, and business metric derivation—the exact skills hiring managers evaluate in take-home data challenges.
How to Present Your SQL Projects on GitHub and Resumes
Follow this checklist to maximize callback rates:
- Repository Structure:
/queries/: Organized.sqlfiles named sequentially (01_schema_setup.sql,02_kpi_analysis.sql)./visuals/: Charts, ER diagrams, or dashboard screenshots.README.md: Concise executive summary with business findings.
- Resume Bullet Point Formula: Weak: "Wrote SQL queries to analyze customer data." Strong: "Engineered an end-to-end SQL customer analytics pipeline analyzing 100k+ transactions across 9 tables; uncovered an 18% delivery delay bottleneck leading to actionable logistics recommendations."
To expand your portfolio beyond SQL, explore our guide on building an end-to-end data analytics portfolio and check our curated Topfolio projects catalog.
Summary Checklist for SQL Projects
- Choose authentic, messy public datasets over overused toy datasets.
- Incorporate CTEs, window functions, and cohort analysis into your query scripts.
- Profile slow queries using execution plans; see our guide on SQL performance tuning.
- Write a structured GitHub
README.mdhighlighting business ROI and insights. - Test your query problem-solving skills interactively on Topfolio Practice.
How to Optimize SQL Projects for Hiring Manager Take-Home Tests
Hiring teams evaluate take-home SQL projects on code quality, not just numerical correctness:
- Consistent SQL Style Guide: Use uppercase for SQL keywords (
SELECT,FROM,WHERE), lowercase snake_case for column identifiers (user_id,created_at), and 4-space indentation. - Explicit Column Names: Never submit
SELECT *in take-home solutions. Always name every selected column explicitly and alias computed columns intuitively (daily_active_users,revenue_run_rate). - Comment Business Rationale: Add concise 1-line comments explaining why you chose a
LEFT JOINover anINNER JOINor why you filtered out negative refund records. - Include a Testing & Validation Query: At the end of your script, include audit queries that verify primary key uniqueness and check for dropped rows.
Discover more real-world projects in our SQL Tutorials hub and practice coding on Topfolio Practice.
Find public, high-volume transactional data for your projects in our curated Free Datasets Guide.
Related SQL Tutorials
- What Is SQL? The Complete Beginner to Pro Guide
- SQL Joins Explained with Practical Examples
- SQL Window Functions Guide
- SQL Cheat Sheet for Analysts
- Explore All Guides in the SQL Tutorials Hub
Build Production-Grade Data Projects
Explore hands-on guided projects with real-world datasets, industry reviews, and portfolio-ready architectures on Topfolio.
Explore Guided ProjectsFrequently Asked Questions
What are the best SQL projects for data analyst resumes?
The best SQL projects solve real business problems: SaaS subscription churn analysis, e-commerce customer cohort retention, multi-touch marketing attribution, and financial transaction fraud detection using real-world public datasets.
How many SQL projects should I include in my portfolio?
Aim for 2 to 3 polished, end-to-end projects. Having two comprehensive projects featuring window functions, CTEs, and BI dashboard integration is far more impressive to hiring managers than 10 trivial toy queries.
Where can I find free datasets for SQL projects?
Top sources include Kaggle Datasets (e.g., Olist Brazilian E-Commerce, Spotify Streaming), Google BigQuery Public Datasets, GitHub public data repos, and classic database samples like Sakila, Northwind, and AdventureWorks.
Should I showcase raw SQL scripts or a full dashboard in my project?
A complete data portfolio project pairs reproducible SQL transformation scripts on GitHub with a visual dashboard (Tableau, Power BI, or Evidence.dev) and a concise one-page executive summary explaining business takeaways.
How do I prove my SQL projects demonstrate advanced skills?
Incorporate analytical window functions (RANK, LAG/LEAD), modular CTE architectures, indexing optimization with EXPLAIN plans, and cohort analysis rather than basic SELECT ... WHERE queries.

Written by
Founder at Topfolio with 6+ years in data & analytics across JPMC, Ultrahuman, and high-growth startups. Sat on hiring panels, reviewed 500+ resumes, and writes practical SQL & data guides.
Related Articles
SQL CTE (WITH Clause): Syntax, Chaining, Recursive CTEs & Real Examples (2026)
Master SQL CTEs (Common Table Expressions) using the WITH clause. Learn exact syntax, execution lifecycle, chaining CTEs, recursive CTEs for org hierarchies, and CTEs vs subqueries vs temp tables.
CREATE TABLE in MySQL: Syntax, Data Types & Constraints Guide
Master CREATE TABLE in MySQL with syntax examples, primary keys, foreign keys, AUTO_INCREMENT, constraints, and InnoDB engine best practices.
DDL SQL Commands: Complete Guide to Data Definition Language
Master DDL SQL commands: CREATE, ALTER, DROP, TRUNCATE, and RENAME with practical syntax, schema constraints, and DDL vs DML comparisons.