In this section, we present several well-designed schemas, populated with data that are used in examples throughout the book.
Overview of Examples¶
This section presents a variety of schema examples that demonstrate different aspects of DataJoint design principles. Each example showcases specific patterns, relationships, and use cases ranging from classic database tutorials to real-world scientific applications.
Classic Database Examples¶
These examples are adapted from well-known database tutorials to show how traditional relational designs map to DataJoint’s entity-workflow model.
Classic Sales Database¶
The classic MySQL tutorial sales database featuring customers, orders, products, and employees. This example demonstrates:
Traditional business database design
Many-to-many relationships through order details
Employee management hierarchies
Product lines and order fulfillment
University Database¶
A university course enrollment system with students, courses, instructors, and enrollments. This example illustrates:
Academic record keeping
Course registration workflows
Student-course many-to-many relationships
Grade tracking and prerequisites
Nations Database¶
A geographical database with countries, regions, and continents from the MariaDB tutorial. This example shows:
Hierarchical geographical relationships
Lookup tables for standardized data
Regional groupings and classifications
Conceptual Examples¶
These examples focus on specific design patterns and conceptual challenges in database modeling.
Hotel Reservation System¶
A complete hotel management system with rooms, reservations, check-ins, and check-outs. This design exercise demonstrates:
Time-series data (room availability and pricing)
Business rule enforcement (no double-booking, check-in requires reservation)
Guest management and payment processing
Temporal queries (who stayed when, room history)
Social Generations¶
Defines social generations as birth cohorts sharing cultural and historical experiences. This example explores:
Lookup tables for reference data
Birth year ranges and generational characteristics
Cultural archetypes and life principles
Using DataJoint to model sociological concepts
Languages and Proficiency¶
A many-to-many relationship design tracking people and their language skills using international standards. This comprehensive example demonstrates:
ISO 639-1 language codes: Standardized two-letter codes for major world languages
CEFR proficiency levels: Common European Framework of Reference for Languages (A1-C2)
Association tables:
Proficiencyas a workflow step linking people, languages, and levelsLookup tables: Both
LanguageandCEFRLevelwith predefined, standardized contentInternational standards: Using established frameworks ensures consistency and compatibility
Sample queries: Finding multilingual individuals, proficient speakers, and language statistics
Organizational Examples¶
These examples model organizational structures and hierarchies.
Management Hierarchy¶
Demonstrates self-referencing tables and organizational relationships. This example shows:
Employees managing other employees (recursive relationships)
Department structure with chairs and budgets
Organizational hierarchies and reporting chains
One-to-one relationships (department chairs)
Normalized department data (codes, names, budgets, locations)
Scientific Examples¶
Real-world scientific applications demonstrating DataJoint in research contexts.
Allen Common Coordinate Framework¶
The Allen Brain Atlas coordinate system for mouse brain anatomy. This example illustrates:
3D spatial coordinates and brain structure atlases
Hierarchical anatomical relationships
Integration with neuroimaging data
Real scientific data pipeline from the DataJoint Elements project
Published standards in neuroscience research
Julia Sets¶
Computational visualization of Julia sets from fractal mathematics. This example demonstrates:
Computed tables for mathematical functions
Parameter spaces and computational workflows
Image generation and visualization
Using DataJoint for reproducible computational art
Automatic computation with
populate()
Each example is self-contained with:
Complete schema definitions
Sample data population
Example queries demonstrating key concepts
Visual diagrams showing table relationships
Code that you can run and modify
Browse through these examples to see different design patterns in action and learn how to apply DataJoint principles to your own domains.