█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Programming Languages/SQL/Passion Project: Schema + Query Gallery
240 minIntermediate

Passion Project: Schema + Query Gallery

After this lesson, you will be able to: Design + build a realistic database (8+ tables, real relationships) and ship a query gallery as a portfolio piece.

Schema + queries are what data-engineer interviews actually test. A polished ER diagram + 15 well-written queries on a real domain proves it better than any cert.

Prerequisites:SQL in Applications

Pick a domain

Real-world data with real questions.

  1. 1

    Option A: SaaS subscription billing, users, subscriptions, plans, payments, invoices, refunds.

  2. 2

    Option B: Library system, books, authors, members, loans, holds, fines.

  3. 3

    Option C: E-commerce, products, categories, customers, orders, line items, reviews, inventory.

  4. 4

    Option D: Movie database, movies, actors, directors, genres, ratings, watch history.

Deliverables

Same for any domain.

  1. 1

    1. ER diagram (dbdiagram.io export, in README).

  2. 2

    2. SQL schema with 8+ tables, FKs, NOT NULL, CHECK constraints, sensible types.

  3. 3

    3. Seed script, `generate_series` or real CSV import to ~10k rows total.

  4. 4

    4. Query gallery: 15 queries in a single file, each commented with the business question.

  5. 5

    5. Indexes: at least 5 thoughtful ones (NOT autocreated from PKs); explain why in README.

  6. 6

    6. README with: ER diagram screenshot, design decisions, query gallery TOC, EXPLAIN ANALYZE on 2-3 queries.

  7. 7

    7. Hosted on Neon free tier so anyone can connect + read.

Query gallery suggestions

Mix easy + hard to show range.

  1. 1

    1-3: Basic SELECT + WHERE + ORDER BY.

  2. 2

    4-6: JOINs (INNER + LEFT) across 3+ tables.

  3. 3

    7-9: GROUP BY + HAVING with aggregations.

  4. 4

    10-11: CTEs (multi-stage logic).

  5. 5

    12-13: Window functions (top-N per group, running totals).

  6. 6

    14: Recursive CTE (if your domain has hierarchy).

  7. 7

    15: A genuine perf-optimized query (with EXPLAIN before + after index).

💡 How to talk about this

INTERVIEW: 'I designed and built BookHaven, a normalized 10-table Postgres schema for a library system. The repo includes 15 production-style queries, indexes with EXPLAIN analyses, and a hosted Neon instance you can connect to.' RESUME: 'BookHaven DB (GitHub link), Postgres 16 schema, ER diagram, indexed for read perf, hosted on Neon.' QUESTIONS to expect: Why this normalization level? How would you scale this? Walk me through your slowest query.

Deployment

Neon free tier (neon.tech). Create a project, run the schema + seed, share a read-only connection string in the README. Bonus: a small Node.js or Python script that runs the query gallery on demand, hosted on Vercel as a tiny page.

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←Database Performance
Back to SQL
SQL Job Readiness→