Javascript SQL Database

I want to deliver some data from the server side to some client-side Javascript, which can use the specified data to build a database / table, and then query it using some custom SQL query.

Saving data is not what I'm looking for, so HTML5 stuff like localStorage is irrelevant, I just want to create something like a mini-database in Javascript for the query.

Are there any Javascript libraries with this feature?

Thanks.

+7
javascript
source share
3 answers

Take a look at TrimQuery .

+2
source share

I would look at TaffyDB . This is a JavaScript database that you can query with objects that resemble where clauses. It is not identical to SQL, but it is close enough that if you already trust your users to write queries, they should be able to hang it.

+1
source share

You can try Alasql database. This is a JavaScript database with the standard "good old" SQL syntax.

<script src="alasql.js"></script> <script> alasql("CREATE TABLE test (language INT, hello STRING)"); alasql("INSERT INTO test VALUES (1,'Hello!')"); alasql("INSERT INTO test VALUES (2,'Aloha!')"); alasql("INSERT INTO test VALUES (3,'Bonjour!')"); console.log(alasql("SELECT * FROM test WHERE language > 1")); </script> 

You can check SQL support using the playground in jsFiddle.

0
source share

All Articles