Skip to content

aadityaexe/Mini-Relational-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

MiniRelDB - Mini Relational Database in C++

MiniRelDB is a lightweight relational database system implemented in C++. It supports core SQL-like operations such as CREATE, INSERT, SELECT, UPDATE, DELETE, and DROP. The system uses file-based persistence to simulate basic database functionality and is designed for educational purposes to understand how databases work under the hood.

🔧 Features

  • 🗃️ Create custom tables with columns and data types
  • 📥 Insert rows into tables
  • 🔍 Select rows with or without conditions
  • ✏️ Update specific rows with WHERE conditions
  • ❌ Delete rows with conditions
  • 🧹 Drop entire tables
  • 💾 Persistent storage using file I/O
  • 🛠️ Easy to compile and run on Windows (MinGW) and Linux

📂 Project Structure

MiniRelDB/
├── MiniRelDB.cpp        # Main C++ source file
├── data/                # Folder for storing table files
└── README.md            # Project documentation

🚀 Getting Started

🖥️ Prerequisites

  • A C++ compiler (e.g. g++, MinGW for Windows)
  • C++17 or later

⚙️ Compilation (Windows/Linux)

# Windows (MinGW)
g++ -std=c++17 -Wall -Wextra -g MiniRelDB.cpp -o MiniRelDB.exe

# Linux
g++ -std=c++17 -Wall -Wextra -g MiniRelDB.cpp -o MiniRelDB

▶️ Run

# Windows
MiniRelDB.exe

# Linux
./MiniRelDB

📜 Supported Commands

✅ CREATE TABLE

CREATE TABLE students (id INT, name STRING, marks INT);

✅ INSERT INTO

INSERT INTO students VALUES (1, "Alice", 85);

✅ SELECT *

SELECT * FROM students;

✅ SELECT WHERE

SELECT * FROM students WHERE marks > 80;

✅ UPDATE

UPDATE students SET marks = 90 WHERE name = "Alice";

✅ DELETE

DELETE FROM students WHERE id = 1;

✅ DROP TABLE

DROP TABLE students;

🗃️ File Storage

  • Each table is stored as a .table file inside the /data directory.
  • Structure and content are saved in plain text format.

🧠 Educational Purpose

This project is ideal for:

  • Learning how basic SQL commands work internally
  • Understanding file-based data persistence
  • Practicing data structures like vectors, maps, strings

🛠️ Tech Stack

  • Language: C++17
  • Storage: File I/O (no external libraries)
  • IDE: Any C++ IDE or text editor (e.g. VS Code)

📌 To Do / Future Enhancements

  • Add support for AND/OR conditions
  • Add primary key constraints
  • Implement command history or scripting mode
  • Improve error handling and validations
  • Add GUI or web interface

📄 License

This project is licensed under the MIT License.


🙋‍♂️ Author

Made with ❤️ by Aditya Kumar

Feel free to contribute, fork, and raise issues!

Let me know if you want it customized further — for example, including screenshots, test data examples, or setup instructions for Linux/Windows separately.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages