# cvincent27/de_01_sql_projet_books architecture

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

- Interactive diagram: https://gitdiagram.com/cvincent27/de_01_sql_projet_books
- Repository: https://github.com/cvincent27/de_01_sql_projet_books

## Overview

##### Main Components
- Database Schema: The central element is the database itself, which comprises multiple tables (e.g., Books, Authors, Genres, Country, Inventory, Sales).
- Data Insertion Scripts: These SQL files (INSERT_DATA_*.sql) are used to populate the tables with data.
- Query Scripts: The SQL queries inside the “Requete_SQL” folder target various aspects of the library (books and authors queries, sales analysis, etc.).
- Sample Data Files: The CSV files in the “data” directory are the source files used for example data insertion.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project clearly divides responsibilities between data definition (table schemas), data population (insertion scripts and CSV examples), and data retrieval (query scripts).
- Modularity: Although it is not a full-stack application with distinct frontend and backend, the modular structure (separate folders for SQL files, queries, and data examples) suggests an organized, layered approach to database management.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Source
    DS["Sample Data Files"]:::dataSource

    %% Data Insertion Scripts (vertical chain)
    DI_author["Insert Author"]:::script
    DI_book["Insert Book"]:::script
    DI_country["Insert Country"]:::script
    DI_genre["Insert Genre"]:::script
    DI_inventory["Insert Inventory"]:::script
    DI_sale["Insert Sale"]:::script

    %% SQL Query Scripts
    Q["SQL Query Scripts"]:::query

    %% ER Diagram Nodes
    ER["ER Diagram"]:::database
    ER_backup["ER Diagram (Backup)"]:::database

    %% Library Database Subgraph with tables
    subgraph "Library Database"
        Authors["Authors Table"]:::database
        Books["Books Table"]:::database
        Genres["Genres Table"]:::database
        Country["Country Table"]:::database
        Inventory["Inventory Table"]:::database
        Sales["Sales Table"]:::database
    end

    %% Data Flow
    DS -->|"import"| DI_author
    DI_author -->|"script"| DI_book
    DI_book -->|"script"| DI_country
    DI_country -->|"script"| DI_genre
    DI_genre -->|"script"| DI_inventory
    DI_inventory -->|"script"| DI_sale
    DI_sale -->|"populate"| Authors
    Sales -->|"queriedBy"| Q

    %% Schema and ER Diagram Relationship
    Authors -->|"defines"| ER
    ER -->|"backup"| ER_backup

    %% Click Events
    click DS "https://github.com/cvincent27/de_01_sql_projet_books/tree/main/data"
    click DI_author "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_author.sql"
    click DI_book "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_book.sql"
    click DI_country "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_country.sql"
    click DI_genre "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_genre.sql"
    click DI_inventory "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_inventory.sql"
    click DI_sale "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/INSERT_DATA_sale.sql"
    click Q "https://github.com/cvincent27/de_01_sql_projet_books/tree/main/Requête SQL/Requete_SQL"
    click ER "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/ERR_diagram.mwb"
    click ER_backup "https://github.com/cvincent27/de_01_sql_projet_books/blob/main/Requête SQL/ERR_diagram.mwb.bak"

    %% Styles
    classDef dataSource fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef script fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef database fill:#a9dfbf,stroke:#333,stroke-width:2px;
    classDef query fill:#f5b7b1,stroke:#333,stroke-width:2px;
```
