{"id":43911,"library":"sql-js","title":"SQL-js","description":"A lightweight JavaScript library that provides an SQL-like query interface for filtering, grouping, and joining in-memory arrays of objects. Version 0.0.1 (current stable 0.1.0) offers a fluent API with methods like select(), from(), where(), groupBy(), having(), and execute(). It supports cross joins between multiple arrays and custom predicate functions. Unlike full SQL databases or query builders (e.g., alasql), SQL-js operates entirely in-memory with zero dependencies, making it ideal for trivial client-side data manipulation. Development appears slow with no recent releases.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/alex030293/sqljs","tags":["javascript","sql","js","interface"],"install":[{"cmd":"npm install sql-js","lang":"bash","label":"npm"},{"cmd":"yarn add sql-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add sql-js","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Only named export; default import will fail.","wrong":"import query from 'sql-js'","symbol":"query","correct":"import { query } from 'sql-js'"},{"note":"Named export; CommonJS require may work in Node but preferred ESM.","wrong":"const QueryBuilder = require('sql-js').QueryBuilder","symbol":"QueryBuilder","correct":"import { QueryBuilder } from 'sql-js'"}],"quickstart":{"code":"import { query } from 'sql-js';\n\nconst data = [\n  { name: 'Han', profession: 'Smuggler', age: 30 },\n  { name: 'Luke', profession: 'Hero', age: 32 },\n  { name: 'Leia', profession: 'Princess', age: 32 },\n  { name: 'Anakin', profession: 'Jedi', age: 50 },\n  { name: 'Obi', profession: 'Jedi', age: 65 },\n  { name: 'Chewie', profession: 'Smuggler', age: 30 },\n  { name: 'Lando', profession: 'Smuggler', age: 50 }\n];\n\nconst result = query()\n  .select()\n  .from(data)\n  .where(p => p.profession === 'Jedi')\n  .execute();\n\nconsole.log(result);\n// [{ name: 'Anakin', profession: 'Jedi', age: 50 }, { name: 'Obi', profession: 'Jedi', age: 65 }]","lang":"javascript","description":"Demonstrates basic usage: import query, filter array using where with a predicate, and execute."},"warnings":[{"fix":"Use .select() without arguments; do not expect column projection.","message":"The .select() method currently takes no arguments; all fields are always returned. Filtering columns is not supported.","severity":"gotcha","affected_versions":"<=0.1.0"},{"fix":"Filter cross join results with .where() and custom predicates to simulate joins.","message":"Join syntax uses multiple array arguments to .from() but only performs cross joins; no INNER/LEFT JOIN semantics.","severity":"gotcha","affected_versions":"<=0.1.0"},{"fix":"Pass a function that extracts the grouping key instead of a string.","message":"The .groupBy() method groups by a function, not a property name. For grouping by a property, use a getter function like (item) => item.age.","severity":"gotcha","affected_versions":"<=0.1.0"}],"env_vars":null,"search_vec":"'0.0.1':28 '0.1.0':31 'alasql':65 'api':35 'appear':88 'array':24,52 'builder':63 'client':83 'client-sid':82 'cross':48 'current':29 'custom':54 'data':85 'databas':60 'depend':76 'develop':87 'e.g':64 'entir':70 'execut':45 'filter':17 'fluent':34 'full':58 'function':56 'group':18 'groupbi':42 'ideal':79 'in-memori':21,71 'interfac':15,97 'javascript':6,94 'join':20,49 'js':3,68,96 'librari':7 'lightweight':5 'like':13,38 'make':77 'manipul':86 'memori':23,73 'method':37 'multipl':51 'object':26 'offer':32 'oper':69 'predic':55 'provid':9 'queri':14,62 'recent':92 'releas':93 'select':39 'side':84 'slow':89 'sql':2,12,59,67,95 'sql-js':1,66 'sql-like':11 'stabl':30 'support':47 'trivial':81 'unlik':57 'version':27 'zero':75","created_at":"2026-06-05T17:02:04.182908+00:00","updated_at":"2026-06-05T17:02:04.182908+00:00","problems":[{"fix":"Use `import { query } from 'sql-js'` and invoke `query()` to start the builder chain.","cause":"Forgetting to call query() as a function or using default import instead of named import.","error":"TypeError: (intermediate value).select is not a function"},{"fix":"Use `import { query } from 'sql-js'` instead of `import query from 'sql-js'`.","cause":"Attempting to default import when only named export exists.","error":"SyntaxError: The requested module 'sql-js' does not provide an export named 'default'"},{"fix":"Ensure .from() receives an array (or multiple arrays for cross join).","cause":"Passing a non-array to .from().","error":"TypeError: data is not iterable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/alex030293/sqljs#readme","github":"https://github.com/alex030293/sqljs","docs":null,"changelog":null,"pypi":null,"npm":"sql-js","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}