Skip to content

About

Relational database design and analytical SQL across MySQL, SQL Server and Oracle, with T-SQL and PL/SQL procedural logic

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DBMS Portfolio – Online Shop Database

Overview

This repository contains a small but complete Database Management Systems (DBMS) portfolio built around an online shop use case.

The work is structured as four incremental challenges (Retos), progressing from:

  • relational schema design,
  • to analytical SQL queries,
  • to cross-database portability and procedural SQL.

The same conceptual data model is implemented across MySQL, SQL Server and Oracle, highlighting both similarities and engine-specific differences..

Database Model

The core domain models an online shop with the following entities:

  • clients – customers placing orders
  • products – items for sale
  • categories – product classification
  • orders – customer purchases
  • order_details – line items linking orders and products

Relationships are enforced using primary keys, foreign keys, and constraints, and visualized via ER diagrams.

Repository Structure

File Purpose
schema.sql MySQL schema definition (Reto 1)
data.sql Sample data for MySQL (Reto 2)
reto2.sql Analytical queries in MySQL (Reto 2)
reto3_sqlserver.sql Full SQL Server (T-SQL) implementation: schema, queries, and procedural logic (Reto 3)
reto4_oracle_plsql.sql Oracle SQL and PL/SQL implementation (Reto 4)
er_diagram_online_shop.png ER diagram for the initial schema
er_diagram_online_shop_reto2.png Updated ER diagram including categories
dev-notes.md Development and environment notes

Reto Breakdown

Reto 1 – Relational Schema (MySQL)

  • Database and table creation
  • Primary keys, foreign keys, and constraints
  • InnoDB engine usage
  • Initial schema

Initial online shop ER diagram

Reto 2 – Queries and Data (MySQL)

  • Sample data insertion
  • Analytical queries using JOIN, GROUP BY, and CTEs:
    • total sales by category
    • average spending per client
    • most sold products
  • Extended schema with categories

Extended online shop ER diagram

Reto 3 – SQL Server (T-SQL)

  • Full schema rewritten for SQL Server:
    • IDENTITY(1,1)
    • DATETIME2
    • strict GROUP BY semantics
  • Queries rewritten in T-SQL
  • Procedural SQL example using:
    • variables
    • WHILE loop
    • PRINT
  • Focus on engine-aware, portable SQL design

Reto 3 – SQL Server (T-SQL)- update This part of the project reproduces the online shop database using Microsoft SQL Server (T-SQL).

The script is fully re-runnable and includes:

  • Database and table creation
  • Sample data insertion
  • Data normalization (foreign key wiring)
  • Analytical queries
  • A procedural T-SQL example

Data normalization is performed before analytical queries to ensure correct relational results.

Reto 4 – Oracle SQL & PL/SQL

This section recreates the online shop database using Oracle SQL and demonstrates procedural logic with PL/SQL.

It includes:

  • Oracle-compatible table definitions and sequences
  • Sample data insertion
  • Referential integrity via foreign keys
  • Stored procedures for:
    • Searching orders by criteria
    • Updating client addresses
    • Recalculating order totals
    • Safely deleting clients with dependency checks
  • Inline test blocks using DBMS_OUTPUT

The script was executed using an Oracle XE instance running in Docker and validated through Oracle SQL Developer.

Technologies Used

  • MySQL 8.x
  • Microsoft SQL Server (T-SQL)
    • Docker (local SQL Server and Oracle database containers)
  • Azure Data Studio (SQL Server client and query execution)
  • MySQL Workbench (ER diagrams)
  • Git & GitHub (version control)
  • Oracle SQL & PL/SQL
  • Oracle SQL Developer

Notes

  • MySQL and SQL Server scripts are intentionally kept separate.
  • SQL Server scripts are not meant to be executed in MySQL.
  • Emphasis is placed on clarity, correctness, and portability, not optimization.

Author

Soraya Rodríguez


Acknowledgements

This project was developed with the assistance of an AI-based instructor (ChatGPT), which provided guidance, explanations, and code reviews throughout the learning process.

All design decisions, implementation, and final results reflect the author's understanding and work.

About

Relational database design and analytical SQL across MySQL, SQL Server and Oracle, with T-SQL and PL/SQL procedural logic

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages