-
Notifications
You must be signed in to change notification settings - Fork 688
From
agershun edited this page Dec 28, 2014
·
9 revisions
From database table
alasql('SELECT * FROM albums');
alasql('SELECT * FROM mydb.test');From parameter
alasql(‘SELECT * FROM ?’,[singers]);From array parameter
alasql(‘SELECT * FROM [?]’,[singers]);From file (FROM-function)
alasql('SELECT * FROM XLSX(“medals.xlsx”)');From stdin (for Node.js)
alasql('SELECT * FROM TXT()');From SELECT statement '''js alasql('SELECT * FROM (SELECT * FROM (SELECT * FROM City))');
## From functions
* TXT()
* JSON()
* CSV()
* TSV() / TAB()
* XLSX() / XLS()
* HTML()
## From parameters (? and [?])
* ? – just value
* [?] – converts array to array of arrays
```js
[1,2,3] => [[1],[2],[3]]
FROM table alias
alasql('SELECT * FROM ? City');
alasql('SELECT * FROM album AS a'); alasql('SELECT * FROM cities'); var data = [{city:"Boston"}, {city:"Los Angeles"}];
alasql('SELECT * FROM ? ORDER BY city',[data]);You can also get data from stdin stream (for Node.js only). For example, how to calculate number of lines in incoming text file:
alasql('SELECT COUNT(*) FROM TXT()');© 2014-2026, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo