How to insert data into the table
Mathias Rangel Wulff edited this page Mar 19, 2018
·
2 revisions
AlaSQL provides three different methods to insert data from array into table:
var data = [{a:1}, {a:2}];
alasql('CREATE TABLE one');
// Method 1
alasql.tables.one.data = data;
// Method 2
alasql('SELECT * INTO one FROM ?',[data]);
// Method 3
alasql('INSERT INTO one SELECT * FROM ?',[data]);
If you download data from external file, you can use this syntax:
alaslq('CREATE table one; SELECT * INTO one FROM JSON("data.json")');
© 2014-2023, Andrey Gershun & Mathias Rangel Wulff
Please let us know if something could be described better by submitting an issue