sql.js

sql.js

SQLite compiled to javascript

sql.js is a port of SQLite to Webassembly, by compiling the SQLite C code with Emscripten.

There are no C bindings or node-gyp compilation here, sql.js is a simple javascript file, that can be used like any traditional javascript library!

Get it: npm install sql.js

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
DROP TABLE IF EXISTS employees;
CREATE TABLE employees( id integer,  name text,
                        designation text,     manager integer,
                        hired_on    date,     salary  integer,
                        commission  float,    dept    integer);

INSERT INTO employees VALUES (1,'JOHNSON','ADMIN',6,'1990-12-17',18000,NULL,4);
INSERT INTO employees VALUES (2,'HARDING','MANAGER',9,'1998-02-02',52000,300,3);
INSERT INTO employees VALUES (3,'TAFT','SALES I',2,'1996-01-02',25000,500,3);
INSERT INTO employees VALUES (4,'HOOVER','SALES I',2,'1990-04-02',27000,NULL,3);


SELECT name,hired_on FROM employees ORDER BY hired_on;

Would output something like:

name hired_on
HOOVER 1990-04-02|
JOHNSON 1990-12-17|
TAFT 1996-01-02|
HARDING 1998-02-02|

GIT FTW!

sql.js

Suggest a module

Comments