Quickstart
Get Databas running on your machine and execute your first SQL queries.Prerequisites
You need Rust installed on your system. If you don’t have it, install it from rustup.rs. Verify your installation:Clone the repository
Build the project
Build all workspace crates using Cargo:This compiles three crates:
databas_cli- Command-line interfacedatabas_core- Database enginedatabas_sql_parser- SQL parser
target/release/databas_cli.Your first queries
The current version parses SQL statements and displays the parsed output. Try these examples in the REPL:Create a table
Insert data
Query data
Use expressions
The parser supports arithmetic expressions and operators:Exit the REPL
Typeexit to quit:
Single query mode
You can execute a single query without entering the REPL by passing it as an argument:Understanding the output
The CLI currently displays the parsed SQL statement as a string representation. This demonstrates that the parser successfully:- Tokenized the input SQL into tokens (keywords, identifiers, operators, literals)
- Parsed the tokens into an abstract syntax tree (AST)
- Validated the SQL syntax structure
- Formatted the AST back to a normalized SQL string
crates/databas_cli/src/main.rs:4-15:
Supported SQL features
The parser currently supports:Data types
INT- Integer valuesFLOAT- Floating-point numbersTEXT- String values
Constraints
PRIMARY KEYNULLABLE
Statements
SELECTwith columns and wildcardsINSERTwith single or multiple rowsCREATE TABLEwith column definitions
Clauses
WHEREwith expressionsORDER BYwith ASC/DESCLIMITandOFFSET
Error handling
If you enter invalid SQL, the parser will report an error with position information:Next steps
Architecture
Learn about the database internals
SQL Reference
Complete SQL syntax reference
Troubleshooting
Build errors
If you encounter build errors, make sure you have Rust edition 2024 support:Can’t find cargo command
Make sure Cargo is in your PATH:.bashrc, .zshrc, etc.) to make it permanent.