A curated set of assignment modules demonstrating database modeling across relational, document, and graph paradigms—aimed at students, educators, and developers.
- Overview
- Repository Structure
- Getting Started
- Usage
- Educational Notes
- Contributing
- License
- Acknowledgments
- Appendix
This repository collects a progression of assignments focused on understanding and practicing data modeling techniques:
- Relational modeling and operations (e.g., Select–Project–Join)
- Document modeling with MongoDB
- Graph modeling with Neo4j
JavaScript (if present) is primarily used for tooling, scripts, or small utilities to set up and interact with the databases. PLpgSQL may appear in relational assignments as stored procedures or functions to demonstrate server-side logic in PostgreSQL. The series is designed to start with fundamentals and build toward more advanced modeling and querying concepts.
A high-level view of the repository:
database-models/
├─ .gitignore
└─ assignments/
├─ 01-spj/
├─ 02-data-modelling/
├─ 03-rsl-lp-db/
├─ 04-mongo-db/
├─ 05-neo4j-db-creator-app/
└─ 06-assessment/
-
Root files:
-
Assignments:
- 01-spj — Fundamentals of relational operations (Select, Project, Join).
- 02-data-modelling — Conceptual/logical/physical modeling exercises.
- 03-rsl-lp-db — Relational schema and query language practice (details if present).
- 04-mongo-db — Document modeling with MongoDB (schemas, indexing, queries).
- 05-neo4j-db-creator-app — Graph modeling and database generation with Neo4j.
- 06-assessment — Capstone or assessment materials.
Explore the top-level assignments directory: assignments
Install the tools relevant to the assignments you plan to run:
- Node.js and npm (if JavaScript tooling is present)
- PostgreSQL (for PLpgSQL or relational assignments, if applicable)
- MongoDB Community Server (for document assignments)
- Neo4j Desktop or Neo4j Server (for graph assignments)
Optional tools:
- A package manager like
pnpmoryarn(if apackage.jsonexists) psqlCLI for PostgreSQLmongoshormongoimportfor MongoDB- Neo4j Browser and APOC library (if needed)
Navigate to the specific assignment folder you want to work on. If a package.json exists:
# from the desired assignment folder
npm install
npm run startDatabase setup suggestions (adjust per assignment):
- PostgreSQL:
- Create a local database:
createdb db_models_dev
- Run schema scripts and PLpgSQL functions (if present):
psql db_models_dev -f ./schema.sql psql db_models_dev -f ./functions.sql
- Create a local database:
- MongoDB:
- Start local server and import seed data:
mongod --dbpath /path/to/db # If seeds present: mongoimport --db db_models_doc --collection items --file ./seed/items.json --jsonArray - Run Node.js scripts (if applicable):
node ./scripts/seed.js
- Start local server and import seed data:
- Neo4j:
- Create a database in Neo4j Desktop or set up a server database.
- Install APOC (if needed) and then run the app/tooling (if present):
# Example environment variables (if required) export NEO4J_URI=bolt://localhost:7687 export NEO4J_USERNAME=neo4j export NEO4J_PASSWORD=your_password npm run start
- Navigate to an assignment that matches your learning goals:
- Relational basics: 01-spj
- Modeling workflows: 02-data-modelling
- Relational practice: 03-rsl-lp-db
- Document modeling: 04-mongo-db
- Graph modeling/app: 05-neo4j-db-creator-app
- Capstone/assessment: 06-assessment
- Read the README or instructions in each folder (if present) for assignment-specific steps.
- Typical workflow:
- Check for
README.md,package.json,.env.example, orscripts/directories. - Install dependencies and configure environment variables:
cp .env.example .env # if present # edit .env with local credentials
- Run scripts or start the app:
npm run start # or node index.js
- Check for
- Expected outputs:
- SQL query results printed to terminal or persisted in tables.
- MongoDB scripts inserting or querying documents.
- Neo4j app generating nodes/relationships and enabling Cypher queries.
- Key concepts:
- Normalization (1NF–3NF+), primary/foreign keys, referential integrity
- Set-based operations: Select, Project, Join, Group By
- Indexes for performance and query planning
- Recommended resources:
- PostgreSQL Docs: SQL Commands
- PostgreSQL Docs: PL/pgSQL
- Use
EXPLAINandEXPLAIN ANALYZEfor performance insights
- Design strategies:
- Schema versioning, validation, and indexing
- Embedding vs referencing trade-offs
- Optimizing for read/write patterns
- Recommended resources:
- MongoDB Docs: Data Modeling
- MongoDB Docs: Indexes
- MongoDB University free courses
- Modeling patterns:
- Nodes and relationships with well-defined labels and properties
- Domain-driven modeling: meaningful relationship types
- Writing Cypher for traversal and pattern matching
- Recommended resources:
- Neo4j Docs: Cypher Query Language
- Neo4j Docs: Data Modeling
- APOC Library: Overview
Contributions are welcome! To propose changes:
- Open an issue describing your improvement or bug report.
- Fork the repo and create a feature branch.
- Make changes with clear commit messages and add/update assignment-level docs.
- Submit a pull request referencing the issue.
Guidelines:
- Follow consistent folder naming (e.g.,
NN-namewith zero-padded numbers). - If JavaScript tooling is present, consider adding linting (e.g., ESLint) and formatting (Prettier).
- Include sample data and setup instructions for new assignments when applicable.
License: TBD
If a LICENSE file is later added, it will define usage terms for the repository.
- Thanks to instructors, course materials, and the communities behind PostgreSQL, MongoDB, and Neo4j.
- Tools and libraries used in assignments (if present) are credited within their respective folders.
- PostgreSQL:
- Connection issues: verify
pg_hba.confand port (default 5432). - Permissions: ensure your role can create schemas/tables/functions.
- Connection issues: verify
- MongoDB:
EACCES/permission errors: check yourdbpathand user permissions.- Import errors: confirm JSON format and use
--jsonArraywhen needed.
- Neo4j:
- Bolt connection failures: verify
NEO4J_URIand credentials. - APOC not found: ensure APOC is installed and enabled in config.
- Bolt connection failures: verify
- If sample datasets are provided, look for
seed/ordata/directories within each assignment. - Prefer small, well-indexed datasets for query performance exploration.
- Use indexes thoughtfully (relational and document).
- Profile queries:
- PostgreSQL:
EXPLAIN ANALYZE - MongoDB:
db.collection.aggregate([...])with$indexStats - Neo4j:
PROFILEandEXPLAINin Cypher
- PostgreSQL: