Skip to content

Database schema

Shady Ashraf Abdelhameed edited this page Jan 31, 2025 · 1 revision

Database Schema


Overview

The database schema is designed to support the management of Walks, Regions, and Difficulty Levels. It includes three main tables: Walks, Regions, and Difficulty. Each table has specific columns to store relevant data, and relationships are established using foreign keys.


Tables

1. Walks Table

Represents individual walking trails.

Column Name Type Nullable Description
Id Unique Identifier (GUID) No Unique ID for each walk.
Name string No Name of the walk.
Description string No Brief description of the walk.
LengthInKm double No Length of the walk in kilometers.
WalkImageUrl string Yes URL of the walk image.
RegionId Unique Identifier (GUID) No ID of the associated region.
DifficultyId Unique Identifier (GUID) No ID of the associated difficulty level.

2. Regions Table

Represents geographical regions where walks are located.

Column Name Type Nullable Description
Id Unique Identifier (GUID) No Unique ID for each region.
Code string No Short code for the region (e.g., TOM).
Name string No Full name of the region.
RegionImageUrl string Yes URL of the region image.

3. Difficulty Table

Represents the difficulty levels of walks.

Column Name Type Nullable Description
Id Unique Identifier (GUID) No Unique ID for each difficulty level.
Name string No Name of the difficulty level (e.g., Easy, Medium, Hard).

Relationships

  1. Walks and Regions:

    • Each walk is associated with a specific region through the RegionId foreign key.
    • A region can have multiple walks, but a walk is linked to only one region.
  2. Walks and Difficulty:

    • Each walk has an associated difficulty level through the DifficultyId foreign key.
    • A difficulty level can be associated with multiple walks, but a walk has only one difficulty level.

ER Diagram

ER Diagram


Explanation of the ER Diagram

Entities:

  1. Walks:

    • Represents individual walking trails.
    • Attributes: Id, Name, Description, LengthInKm, WalkImageUrl, RegionId, DifficultyId.
  2. Regions:

    • Represents geographical regions where walks are located.
    • Attributes: Id, Code, Name, RegionImageUrl.
  3. Difficulty:

    • Represents the difficulty levels of walks.
    • Attributes: Id, Name.

Relationships:

  1. Regions ↔ Walks:

    • One-to-many relationship.
    • A region can have multiple walks, but a walk belongs to only one region.
  2. Difficulty ↔ Walks:

    • One-to-many relationship.
    • A difficulty level can be associated with multiple walks, but a walk has only one difficulty level.

Clone this wiki locally