npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sqlsim

v0.0.1

Published

SQL Simulator in Javascript. Performance and storage space be damned! This is an in-memory simulator meant to show how SQL works, allowing inspection of database state at any (and every!) time during execution.

Downloads

3

Readme

SQLSim

SQL Simulator in Javascript. Performance and storage space be damned! This is an in-memory simulator meant to show how SQL works, allowing inspection of database state at any (and every!) time during execution.

Install

Clone the repository then run the following commands:

$ bun install
$ bun test

Don't have bun? You can get it here. If you don't want to use bun, you can also easily use npm or yarn instead.

Supported SQL Flavors

  • [x] MySQL

More to come!

Keywords Supported

General

  • [x] CREATE TABLE (see below)
  • [x] INSERT INTO Table VALUES ... (all-column insert)
  • [x] INSERT INTO Table (col1, col2, ...) VALUES ... (column-specific inserts)
  • [x] UPDATE Table SET _col1 = ...; (update all records)
  • [x] UPDATE Table SET _col1 = ..., col2 = ... WHERE ... (single and multi column updates with filtering)
  • [x] SELECT * FROM Table (basic selection)
  • [x] SELECT col1, col2, ... FROM Table (column filtering via projection)
  • [x] SELECT col3, col3, col3 FROM Table (column expansion via projection)
  • [x] SELECT (col2 + 5) FROM Table (expressions via projection)
  • [x] SELECT ... FROM Table WHERE expression (row filtering via expressions, see below)
  • [x] SELECT ... FROM Table JOIN AnotherTable ON expression (inner joins)
  • [x] SELECT ... FROM Table LEFT JOIN AnotherTable ON expression (left joins)
  • [x] SELECT ... FROM Table RIGHT JOIN AnotherTable ON expression (right joins)
  • [x] SELECT ... FROM Table FULL JOIN AnotherTable ON expression (full joins)
  • [x] SELECT ... FROM Table CROSS JOIN AnotherTable (cross join)
  • [x] SELECT Table1.col1, Table2.col2 FROM Table1 JOIN Table2 ON ... (table name prefixing)
  • [x] SELECT ... FROM Table AS NewName (AS for table names)
  • [x] SELECT col1 AS newname FROM ... (AS for column names)
  • [ ] SELECT 5 AS newname (selecting literals with AS for dymanic table creation)
  • [x] SELECT ... FROM Table WHERE (SELECT ...) (subqueries in the WHERE clause)
  • [x] SELECT ... FROM Table WHERE col1 > (SELECT AVG(col1) FROM ... WHERE col2 = Table.col2) (correlated subquery)
  • [x] SELECT ... FROM (SELECT ...) (subqueries in the FROM clause)
  • [ ] SELECT _(SELECT ...) FROM ... (subqueries in the projection list)
  • [x] SELECT ... FROM ... ORDER BY col1 ASC, col2 DESC, ... (single and multi-column row ordering, with direction)
  • [x] SELECT ... FROM ... ORDER BY col1 > 5, ... (single and multi-column row ordering with expressions)
  • [x] SELECT FUNC(col1) FROM Table (simple aggregation)
  • [x] SELECT FUNC(col1 + 100) FROM Table (aggregation with expressions)
  • [x] SELECT FUNC(col1) + 100 FROM Table (aggregation as expressions)
  • [x] SELECT groupCol, FUNC(col1) FROM Table GROUP BY (aggregation with grouping)
  • [x] SELECT groupCol, FUNC(col1) FROM Table GROUP BY ... HAVING ... (with grouping and filtering)

CREATE TABLE

  • [ ] Data type constraints (e.g., INTEGER, VARCHAR(20), etc.)
  • [ ] AUTO_INCREMENT constraint
  • [ ] UNIQUE constraint
  • [ ] NOT NULL constraint
  • [ ] PRIMARY KEY (col1) constraint (single primary key)
  • [ ] PRIMARY KEY (col1, col2, ...) constraint (composite primary key)
  • [ ] FOREIGN KEY ... REFERENCES ... constraint
  • [ ] ON UPDATE constraint
  • [ ] ON DELETE constraint
  • [ ] CHECK constraints

Expressions (e.g., in WHERE clause)

  • [x] Column references (e.g., age > ...)
  • [x] + operator
  • [x] - operator
  • [x] / operator
  • [x] * operator
  • [x] = operator
  • [x] != operator
  • [x] < operator
  • [x] <= operator
  • [x] > operator
  • [x] >= operator
  • [x] <> operator
  • [x] AND operator
  • [x] OR operator
  • [x] IS operator (Note: only TRUE/FALSE supported; UNKNOWN not yet supported)
  • [x] IS NOT operator (Note: only TRUE/FALSE supported; UNKNOWN not yet supported)
  • [x] IN (...expression list...) operator
  • [x] IN (...subquery...) operator
  • [x] NOT IN (...expression list...) operator
  • [x] NOT IN (...subquery...) operator
  • [x] LIKE operator
  • [ ] ANY operator
  • [ ] SOME operator

Aggregation Functions

  • [x] AVG()
  • [ ] AVG(DISTINCT)
  • [ ] BIT_AND()
  • [ ] BIT_OR()
  • [ ] BIT_XOR()
  • [x] COUNT()
  • [ ] COUNT(DISTINCT)
  • [ ] GROUP_CONCAT()
  • [ ] GROUP_CONCAT(DISTINCT)
  • [ ] JSON_ARRAYAGG()
  • [ ] JSON_OBJECTAGG()
  • [x] MAX()
  • [ ] MAX(DISTINCT)
  • [x] MIN()
  • [ ] MIN(DISTINCT)
  • [ ] STD()
  • [ ] STDDEV()
  • [ ] STDDEV_POP()
  • [ ] STDDEV_SAMP()
  • [x] SUM()
  • [ ] SUM(DISTINCT)
  • [ ] VAR_POP()
  • [ ] VAR_SAMP()
  • [ ] VARIANCE()