Hi HN! My pet project for the last couple of months has been SQLToy.
SQLToy is an in-memory SQL database written in Javascript. It is under 500 lines of code and has zero dependencies. It supports the following SQL operations:
SELECT
- FROM
- CROSS JOIN
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- WHERE
- GROUP BY
- Aggregate functions: ARRAY_AGG, MAX, MIN, COUNT
- DISTINCT
- ORDER BY
- OFFSET
- LIMIT
- CREATE TABLE
- INSERT INTO
- UPDATE
The purpose of SQLToy is to teach SQL. Instead of doing this from the "outside-in" by teaching the query language it is done "inside-out" by going through the implementation of the most common SQL operators. Instead of just learning what the operators do, you will also learn how they do it which (hopefully!) should lead to a much deeper level of understanding.
In addition to the code in the repo there is an associated Wiki (about 10 times longer than the code itself!) which walks through the implementation of each operation.
1 comment
[ 2.3 ms ] story [ 13.3 ms ] threadSQLToy is an in-memory SQL database written in Javascript. It is under 500 lines of code and has zero dependencies. It supports the following SQL operations:
SELECT - FROM - CROSS JOIN - INNER JOIN - LEFT JOIN - RIGHT JOIN - WHERE - GROUP BY - Aggregate functions: ARRAY_AGG, MAX, MIN, COUNT - DISTINCT - ORDER BY - OFFSET - LIMIT - CREATE TABLE - INSERT INTO - UPDATE
The purpose of SQLToy is to teach SQL. Instead of doing this from the "outside-in" by teaching the query language it is done "inside-out" by going through the implementation of the most common SQL operators. Instead of just learning what the operators do, you will also learn how they do it which (hopefully!) should lead to a much deeper level of understanding.
In addition to the code in the repo there is an associated Wiki (about 10 times longer than the code itself!) which walks through the implementation of each operation.
Feedback appreciated!