Skip to content

db-academy-io/sql_parser

Repository files navigation

An SQL query parser


db-academy.io/sql_parser reference implementation in Rust


The following list of SQL statements, taken from the official SQLite documentation, is ordered by difficulty and the time required for implementation, from easier and quicker to harder and more time-consuming. There are exceptions where certain statements are simpler to implement than the preceding ones. These exceptions are intentional and made solely for grouping related statements.

Simple statements progress

  1. drop-statements
    1. drop-table-stmt
    2. drop-index-stmt
    3. drop-trigger-stmt
    4. drop-view-stmt
  2. sqlite3-statements
    1. vacuum-stmt
    2. detach-stmt
    3. analyze-stmt
    4. reindex-stmt
    5. pragma-stmt
  3. transaction-statements
    1. begin-stmt
    2. commit-stmt
    3. rollback-stmt
  4. savepoint-stmt
    1. savepoint-stmt
    2. release-stmt

Intermediate statements

Parsing sql expression progress

  1. literal-value
  2. bind-parameter
  3. identifiers
  4. unary-operator
  5. binary-operator
  6. function
  7. parenthesized-expression
  8. cast-expression
  9. collate-expression
  10. like-expression
  11. null-expression
  12. expression-from-expression
  13. between-expression
  14. expression-in-select
  15. exists-expression
  16. case-expression
  17. raise-function

Parsing sql statements progress

  1. attach-stmt
  2. alter-table-stmt

Advanced statements

SELECT statement progress

  1. select-core-stmt
    1. values-stmt
    2. result-columns
    3. table-or-subquery
    4. join-clauses
    5. where-group-by-having-clause
    6. window-functions
  2. compound-stmt
  3. order-by-and-limit-clause
  4. common-table-expressions

DELETE statement progress

  1. delete-stmt-core
  2. delete-stmt-with-cte
  3. delete-stmt-limited

UPDATE statement progress

  1. update-stmt
  2. update-stmt-limited

INSERT statement progress

  1. insert-with-values
  2. insert-as-select
  3. insert-with-upsert
  4. insert-as-default
  5. insert-with-returning
  6. insert-with-cte
  7. replace-stmt

CREATE statements progress

  1. create-virtual-table-stmt
  2. create-index-stmt
  3. create-view-stmt
  4. create-table-stmt
  5. create-trigger-stmt

EXPLAIN statement progress

  1. explain-stmt

Optional statements progress

  1. math-functions
  2. date-and-time-functions
  3. json-functions
  4. core-functions
  5. aggregate-functions

About

An SQLite fully compatible tokenizer and hand-written parser in Rust

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published