# js-sql-parser
> parse / stringify sql (select grammar) in js.
[![Build Status][travis-image]][travis-url]
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html
## news
- Typo 'refrence' has been fixed to 'reference' since v1.2.0.
- Fix bug stringify keyword `having` since v1.2.1. [#29](https://github.com/JavaScriptor/js-sql-parser/issues/29)
- Add support for "`" quoted alias since v1.2.2. [#33](https://github.com/JavaScriptor/js-sql-parser/issues/33)
for more changes see [CHANGELOG](./CHANGELOG)
## commonjs usage
`npm install --save js-sql-parser`
```js
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
```js