A comprehensive Database Management System built entirely in Bash scripting that demonstrates how modern databases work internally using file system operations for data storage and management.
- Create new databases
- List all existing databases
- Connect to specific databases
- Drop databases with confirmation
- Create tables with custom schema
- Define column types and constraints
- Set primary keys with uniqueness validation
- List all tables in a database
- Drop tables safely
CLI Operations:
- Interactive menu-driven data insertion
- Table browsing and display
SQL Query Support:
INSERT- Add new records with validationSELECT- Query data with filtering conditionsUPDATE- Modify records (single or batch operations)DELETE- Remove records with condition matchingUSE- Switch between databases
- Data Types:
int,float,string,character,email - Base64 Encoding/Decoding for secure data storage
- Primary Key Constraints with duplicate prevention
- ** Atomic Transaction-like Operations** using temporary files
- Dual Interfaces: Menu-driven CLI and SQL command interface
- Data Validation and integrity checks
- Schema Management with metadata files
-
Clone the repository
-
Make scripts executable:
chmod +x *.sh- Run the application:
./dbms-main.sh# Start the application
./dbms-main.sh
# Use menu to:
# 1. Create Database -> company
# 2. Connect to Database -> company
# 3. Create Table -> employees (id:int:pk, name:string, email:email)
# 4. Insert data via interactive prompts-- Switch database
USE company;
-- Insert data
INSERT INTO employees (id, name, email) VALUES (1, "John Doe", "[email protected]");
-- Select all records
SELECT * FROM employees;
-- Select with conditions
SELECT name FROM employees WHERE id = 1;
-- Update records
UPDATE employees SET name=Jane WHERE id=1;
UPDATE employeea SET name=ahmed;
-- Delete records
DELETE FROM employees WHERE id = 1;| Type | Description | Validation |
|---|---|---|
int |
Integer numbers | /^-?[0-9]+$/ |
float |
Floating-point numbers | /^-?[0-9]*\.[0-9]+$/ |
string |
Text data | Any string value |
character |
Single character | /^.$/ |
email |
Email addresses | RFC-compliant email regex |
- Databases: Stored as directories in
databases/ - Tables: Each table is a file containing encoded data rows
- Metadata: Schema information stored in hidden
.tablename-metadatafiles - Encoding: All data is Base64 encoded for security and integrity
- Database Engine: Handles database creation, connection, and management (CLI)
- Table Manager: Manages table schema, creation, and deletion (CLI)
- Data Processor: Handles CRUD operations with validation
- SQL Parser: Processes SQL queries (INSERT, SELECT, UPDATE, DELETE, USE)
- Validation Layer: Ensures data integrity and type constraints
- Eng. Mahmoud El-Mahmoudy - For exceptional guidance and setting the highest educational standards
- Ibrahim - For outstanding collaboration and technical contributions during development
- Index support for faster queries
- Join operations between tables
- Backup and restore functionality
- User authentication and permissions
- Query optimization
- Transaction support with rollback
- REST API interface
- Complete DDL SQL support (CREATE, DROP, ALTER)