Skip to content

An educational project designed to explore fundamental data structures and algorithms by creating a simple database management system

Notifications You must be signed in to change notification settings

AminRezaeeyan/CustomDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CustomDB

CustomDB is an educational project designed to explore fundamental data structures and algorithms by creating a simple database management system. This project demonstrates how structures like linked lists, hashmaps, and red-black trees can be used to efficiently manage and manipulate data.

Project Overview

CustomDB simulates key database functionalities, providing a hands-on experience in designing and implementing data structures. Developed in C, the project avoids external libraries to focus on foundational programming skills.

Features

  • Table Management: Dynamically create and delete tables.
  • Record Operations: Add, delete, update, and query records within tables.
  • Indexing: Use red-black trees to create and maintain indexes for efficient data retrieval.
  • Sorted Queries: Retrieve records in sorted order based on primary key.

Core Data Structures

Linked List

  • Purpose: Implements doubly linked lists for managing table records.
  • Benefits: Supports dynamic memory allocation and efficient record insertion and deletion.

Hashmap

  • Purpose: Maps table names to their respective data structures.
  • Benefits: Enables constant-time lookup for table management, ensuring scalability.

Red-Black Tree

  • Purpose: Maintains indexes on primary keys for quick searching and sorting.
  • Benefits: Guarantees balanced operations with (O(log n)) complexity for insertions, deletions, and lookups.

Supported Commands

CustomDB offers a command-driven interface for the following operations:

  1. CREATE/DELETE TABLE <table_name>: Create or delete tables dynamically.
  2. CREATE INDEX <table_name>: Build an index on the primary key using a red-black tree.
  3. ADD <table_name> <column_name> <value>: Add a new record to a table.
  4. DELETE <table_name> <column_name> <value>: Remove records where the column matches the value.
  5. UPDATE <table_name> <column_name> <value> <new_value>: Update values in matching records.
  6. SELECT <table_name> <column_name> <value> [SORTED]: Query and optionally sort records by primary key.
  7. PRINT TABLE <table name>: Print the table

Column Names

CustomDB supports a predefined schema with the following columns:

  • student_id: An integer representing the unique ID of a student (primary key).

  • course_name_general: A string (up to 32 characters) for the name of a general course.

  • general_course_instructor: A string (up to 32 characters) for the instructor of a general course.

  • general_course_score: An integer score (0 to 20) for the general course.

  • course_name_core: A string (up to 32 characters) for the name of a core course.

  • core_course_instructor: A string (up to 32 characters) for the instructor of a core course.

  • core_course_score: An integer score (0 to 20) for the core course.

Educational Goals

CustomDB is designed to:

  • Learn Data Structures: Demonstrate practical applications of linked lists, hashmaps, and red-black trees.
  • Enhance Algorithm Design Skills: Explore efficient sorting and data manipulation algorithms.
  • Highlight Performance: Show the importance of (O(1)) and (O(log n)) complexities for operations.

How to Use

  1. Compile the Project: Use the provided Makefile:

    make all
  2. Run the Program:

    ./main

    Limitations

  • Supports only a predefined table schema.
  • Intended for educational purposes, lacking production-level optimizations.

Conclusion

CustomDB bridges the gap between theoretical concepts and practical applications by integrating core data structures into a functioning database system. It provides a valuable learning experience for students and enthusiasts seeking to deepen their understanding of data structures in real-world use cases.

About

An educational project designed to explore fundamental data structures and algorithms by creating a simple database management system

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published