An educational Relational Database Management System (RDBMS) built from scratch in modern C++20 with an interactive desktop GUI powered by Qt 6.
The goal of this project is to explore database internals "under the hood": query tokenization, finite-state machine (FSM) syntax parsing, relational query execution planning, and disk snapshot persistence.
The system is decoupled into modular layers:
- Input: SQL Query string
- Lexer and Parser: Zero-regex Finite-State Machine (FSM) tokenizer and parser (
O(N)token scan) validating grammar rules and syntax tokens - Query Representation: Structured intermediate representation (
Querycommand object) representing DDL, DML, or DQL commands - Execution Engine: Evaluates relational queries, performing multi-condition filtering (
WHERE), hash-based table joins (JOIN/LEFT JOIN), and hash-based aggregations (GROUP BY/HAVING) - Storage Layer: Columnar in-memory table layout (
std::vector<Column>) with file-based snapshot persistence,PRIMARY KEY/FOREIGN KEYconstraint validation, and schema type management (INTEGER,NVARCHAR2,DATE) - Desktop UI: Qt 6 graphical interface featuring
QSyntaxHighlighter, query tabs, and table grid visualization viaQAbstractTableModel
- Custom SQL Engine:
- DDL:
CREATE TABLE(withPRIMARY KEYuniqueness andFOREIGN KEY REFERENCESreferential integrity checks),DROP TABLE. - DML:
INSERT INTO,UPDATE,DELETE(full table or filtered viaWHERE). - DQL:
SELECT ... FROM ... WHEREwith multi-conditional filtering (AND, comparison operators). - Aggregations and Grouping: Hash-based
GROUP BY,HAVING, and aggregate functions (COUNT,SUM,MIN,MAX). - Relationships: Hash-based
JOINandLEFT JOINevaluation (O(N + M)) between tables.
- DDL:
- Desktop Database Explorer (Qt 6):
- Custom code editor with real-time SQL syntax highlighting (
QSyntaxHighlighter). - Tabular data visualization implemented via
QAbstractTableModel. - Tabbed query workspace and interactive schema explorer.
- Custom code editor with real-time SQL syntax highlighting (
- Robust Verification:
- 100+ automated unit and integration tests using GoogleTest covering parser state transitions, relational joins, aggregations, key constraints, and execution benchmarks.
- Language: C++20 (GCC 11+, Clang 13+, or MSVC 2019+)
- GUI Framework: Qt 6.x (Core, Gui, Widgets)
- Build System: CMake 3.20+
- Third-Party Libraries:
fmtlibfor modern string formattinggoogletestfor test automation
git clone https://github.com/arseniizar/DBMS-cpp.git
cd DBMS-cppcmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j./build/DatabaseProjectcd build && ctest --output-on-failure