an sqlite-inspired relational database engine written from scratch in C which I built to learn more about databases, their architecture, different design choices and tradeoffs. Started as educational, but may evolve if time permits.
This database consists of an SQL-like language interpreter that interprets input from the REPL using a custom lexer for tokenizing, a recursive descent parser for building the AST and finally the executor which runs the statements. The storage layer is handled by the executor. Tables are stored in .tbl files and contain information such as schema, column names, column metadata and of course, the rows. The contents are serialized and written and manipulated as binary.
- Clone the repository
git clone https://www.github.com/manoj-marimuthu/mini-rdbms- Use the makefile
make- Remember that the command might differ based on the compiler or Operating system. For example-
mingw32-make- Use a C compiler such as mingw
- CREATE
- INSERT
- SELECT (Only * for now)
- DESCRIBE
- meta commands such as .help, .version and .exit (or .quit)
- INT, TEXT (Fixed size)
- REPL-based
- Binary storage (each table gets a .tbl file with schema and rows).
- A create a table with a specific schema use the
CREATEkeyword. Example-
CREATE TABLE example(field1 INT,field2 TEXT);- To insert into a table,
INSERT INTO example(10,"Some random text");- To view the table
SELECT * FROM example;- For now only
*is supported and new features will be added in v0.1.0. - To see the table structure,
DESCRIBE example;- The above displays column names, the data type it accepts and the size (in bytes).
- Meta commands
| Command | What it does ? |
| .exit or .quit | exits the database shell |
| .help | Displays all supported features for current version |
| .version | Displays DB version |
-
INT- holds integer (no negatives / decimals yet, I was lazy to add them since my goal was to build a working version first and then progress it with features) -
TEXT- 32 byte string, fixed size (Will be variable size in the upcoming versions after paging).
- Bytecode compilation
- Aggregate functions, more datatypes and variable sizing.
- Paging
- B+ Trees (long term goal)
Manoj K.M Written with C and Curiosity