Tutorial

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.

Anuj SainiSep 8, 20268 min read

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:

  1. Business Metric Fluency: Translating ambiguous concepts like "customer engagement" into concrete SQL calculations (DAU/MAU ratios, churn rates).
  2. Defensive Query Writing: Guarding against data traps like row duplication from non-unique joins and division-by-zero errors.
  3. Advanced Analytical Logic: Utilizing Common Table Expressions (CTEs), window functions, and conditional aggregation.
  4. 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?
sql
-- 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?
sql
-- 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.

sql
-- 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:

  1. Repository Structure:
    • /queries/: Organized .sql files 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.
  2. 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.md highlighting 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:

  1. 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.
  2. 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).
  3. Comment Business Rationale: Add concise 1-line comments explaining why you chose a LEFT JOIN over an INNER JOIN or why you filtered out negative refund records.
  4. 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.

Build Production-Grade Data Projects

Explore hands-on guided projects with real-world datasets, industry reviews, and portfolio-ready architectures on Topfolio.

Explore Guided Projects

Frequently 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.

Anuj Saini

Written by

Anuj SainiFounder & Lead Instructor

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.