A mini relational database management system (RDBMS) built in C++ by following the official NITCbase roadmap.
This project demonstrates how a database works internally, starting from disk block storage up to relational algebra operations like select, project, and join.
The goal of this project was to understand and implement the core internal working of a DBMS.
The implementation starts from low-level disk operations and gradually builds higher layers such as buffer management, cache management, schema handling, and query operations.
Compile:
make clean make
Run:
./nitcbase
The project was created and compiled using:
makeThe required readline library was installed for frontend interaction.
Implemented:
Disk::readBlock()Disk::writeBlock()
Purpose:
- Reads fixed-size blocks from the database file
- Writes modified blocks back to disk
This is the lowest storage layer.
Implemented:
StaticBufferBlockBufferRecBuffer
Purpose:
- Loads disk blocks into memory
- Reduces repeated disk access
- Improves speed
Implemented:
RelCacheTableAttrCacheTableOpenRelTable
Purpose:
- Stores relation metadata in memory
- Stores attribute metadata in memory
- Tracks opened relations
This helps fast metadata access.
Implemented:
BlockAccess::linearSearch()BlockAccess::search()
Purpose:
- Searches records by scanning one by one
- Finds records matching conditions
Implemented:
BlockAccess::insert()
Purpose:
- Inserts records into free slots
- Updates slot map and headers
Example:
101 Saurav 95
Implemented:
OpenRelTable::openRel()OpenRelTable::closeRel()
Purpose:
- Opens relations into cache
- Closes them after use
Implemented:
Schema::createRel()Schema::deleteRel()
Purpose:
- Adds relation metadata into
RELATIONCAT - Adds attribute metadata into
ATTRIBUTECAT - Deletes relation and its attributes
Implemented:
BlockAccess::project()
Purpose:
- Reads records from relation
Output example:
RELATIONCAT 6 4 4 4 20
Implemented:
BlockAccess::renameRelation()BlockAccess::renameAttribute()
Purpose:
- Rename table names
- Rename column names
Example:
Students → Learners → Students
Implemented:
Algebra::select()
Purpose:
- Select records using conditions
Example:
SELECT * FROM Students WHERE Name = "Saurav"
Implemented:
Algebra::join()
Purpose:
- Combines two relations using common attributes
Example:
RELATIONCAT JOIN ATTRIBUTECAT ON RelName
| Stage | Status |
|---|---|
| Stage 0 | Completed |
| Stage 1 | Completed |
| Stage 2 | Completed |
| Stage 3 | Completed |
| Stage 4 | Completed |
| Stage 5 | Completed |
| Stage 6 | Completed |
| Stage 7 | Completed |
| Stage 8 | Completed |
| Stage 9 | Completed |
| Stage 10 | Completed |
| Stage 11 | Completed |
| Stage 12 | Completed |
Algebra/→ Relational operationsBlockAccess/→ Record access methodsBuffer/→ Buffer managementCache/→ Metadata cachingDisk_Class/→ Disk operationsFrontend/→ User interfaceFrontendInterface/→ Command parserSchema/→ Schema managementdefine/→ Constants and IDs
Compile:
make clean
makeRun:
./nitcbase- C++
- File Handling
- Data Structures
- Buffer Management
- Relational Algebra
- Database Internals
- B+ Tree Indexing
- Index-based Search
- Query Optimization
- Full SQL Support
Saurav Kumar Singh B.Tech CSE National Institute of Technology Calicut




