SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html
parse / stringify sql (select grammar) in js.
sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html
using ' & " for column alias?since v1.4.1 #40, #44
havingsince v1.2.1. #29
for more changes see CHANGELOG
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