# manoeltelesps/database_projects architecture

> Architecture diagram of the GitHub repository manoeltelesps/database_projects, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manoeltelesps/database_projects
- Repository: https://github.com/manoeltelesps/database_projects

## Overview

##### Project Type and Purpose
- This is a collection of database‐centric exercises and practical SQL scripts (MySQL) for learning and experimenting with data modeling and manipulation.
- There is no frontend or application server—your system “understanding” revolves around SQL script files, the database engine, and the resulting schemas.

##### Main Components
a. Development Environment
- A developer machine or container where scripts are authored and executed.
- Version control (Git) as an external service.
b. SQL Script Repositories
- “Atividades” folder: DDL scripts to create databases and tables.
- “Aulas/aula_1” and “Aulas/aula_2” folders: Additional schema definitions and data‐manipulation scripts.
c. Database Engine
- MySQL (or another target engine) that executes the scripts and hosts the schemas.
d. Resulting Database Schemas
- Tables (e.g., bibliotecabd, Livraria) with their relationships, primary/foreign keys.

##### Relationships and Data Flow
- Script files → (execute) → Database Engine
- Database Engine → (manages) → Physical tables, constraints, indexes
- Developer ↔ (Git push/pull) ↔ Git repository

##### Key Architectural Patterns & Principles
- Separation of concerns: scripts are organized by exercise type (Atividades vs. Aulas).
- Idempotent DDL: each script should cleanly create or alter schemas.
- Versioning: all SQL artefacts under Git for reproducibility.

##### Step‐by‐Step for the Principal Software Engineer
2. Drill down into MySQL: show schemas and tables created by Atividades and Aulas scripts.
3. For each script grouping: include an ERD showing table structure & relationships.

## Diagram (Mermaid)

```mermaid
graph TD
    direction TB

    subgraph "Developer Environment"
        Dev[/Developer/]:::developer
        subgraph "Git Repository"
            gitignore[".gitignore"]:::scripts
            readme["README.md"]:::scripts
            subgraph "Atividades"
                atv["Atividade-Criação_de_Bancos_de_Dados_e _Tabelas.sql"]:::scripts
            end
            subgraph "Aulas"
                subgraph "aula_1"
                    bibfile["bibliotecabd.sql"]:::scripts
                end
                subgraph "aula_2"
                    livraria["Livraria.sql"]:::scripts
                    manip["manipulacaoLivraria.sql"]:::scripts
                end
            end
        end
    end

    extgit[(GitHub Service)]:::external

    Dev -->|"push/pull"| extgit
    Dev -->|"edits scripts"| gitignore

    atv -->|"Execute .sql"| mysql
    bibfile -->|"Execute .sql"| mysql
    livraria -->|"Execute .sql"| mysql
    manip -->|"Execute .sql"| mysql

    subgraph "MySQL Server" 
        direction TB
        mysql[(MySQL Server)]:::engine
        Table1["BIBLIOTECABD<br/>- id (PK)<br/>- title"]:::table
        Table2["LIVRARIA<br/>- book_id (PK)<br/>- fk_biblio_id (FK)"]:::table

        mysql --> Table1
        mysql --> Table2
        Table1 -->|"1-to-many"| Table2
    end

    classDef scripts fill:#BBDEFB,stroke:#1976D2,color:#0D47A1
    classDef engine fill:#C8E6C9,stroke:#388E3C,color:#1B5E20
    classDef table fill:#ECEFF1,stroke:#90A4AE,color:#37474F
    classDef developer fill:#FFF9C4,stroke:#FBC02D,color:#F57F17
    classDef external fill:#E1BEE7,stroke:#8E24AA,color:#4A148C

    click gitignore "https://github.com/manoeltelesps/database_projects/blob/main/.gitignore"
    click readme "https://github.com/manoeltelesps/database_projects/blob/main/README.md"
    click atv "https://github.com/manoeltelesps/database_projects/blob/main/Atividades/Atividade-Criação_de_Bancos_de_Dados_e _Tabelas.sql"
    click bibfile "https://github.com/manoeltelesps/database_projects/blob/main/Aulas/aula_1/bibliotecabd.sql"
    click livraria "https://github.com/manoeltelesps/database_projects/blob/main/Aulas/aula_2/Livraria.sql"
    click manip "https://github.com/manoeltelesps/database_projects/blob/main/Aulas/aula_2/manipulacaoLivraria.sql"
```
