Need help with js-sql-parser?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

162 Stars 32 Forks MIT License 98 Commits 14 Opened issues


SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar follows

Services available


Need anything else?

Contributors list


parse / stringify sql (select grammar) in js.

Build Status NPM Version NPM Downloads

sql grammar follows


  • Fix bug
    using ' & " for column alias?
    since v1.4.1 #40, #44
  • Fix bug tableFactor alias since v1.3.0 #34
  • Add support for "`" quoted alias since v1.2.2. #33
  • Fix bug stringify keyword
    since v1.2.1. #29
  • Typo 'refrence' has been fixed to 'reference' since v1.2.0.

for more changes see CHANGELOG

commonjs usage

npm install --save js-sql-parser
const parser = require('js-sql-parser');
const ast = parser.parse('select * from dual');

console.log(JSON.stringify(ast, null, 2));

ast.value.selectItems.value[0].value = 'foo'; ast.value.from.value[0].value.value.value = 'bar';

console.log(parser.stringify(ast)); // SELECT foo FROM bar

script tag

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.