A SQL database, written from scratch in Go
- Compilers: Principles, Techniques, and Tools
- Designing Data-Intensive Applications
- How query engines work
- dolthub/go-mysql-server
- Split raw sql command to token
raw sql: select id, name, age from user where status = 'ACTIVE' and id > 10
=> tokens: ["select", "id", ",", "name", ",", "age", "from", "user", "where", "status", "=", "'", "ACTIVE", "'", "and", "id", ">", "10"]
- Make Abstract syntax tree (AST) from list tokens
root
|- select
|---- fields (id, name, age)
|- from
|---- tables (user)
|- where
|---- conditions
|---- status
|---- =
|---- ACTIVE
|- AND
|---- id
|---- >
|---- 10