-
Notifications
You must be signed in to change notification settings - Fork 664
Identity
Mathias Rangel Wulff edited this page Jun 12, 2015
·
4 revisions
Syntax:
CREATE TABLE tableid (
columnid typeid IDENTITY [(start [, step])]
);
AlaSQL supports autoincrement feature:
alasql('CREATE TABLE one (a INT AUTO_INCREMENT, b STRING)');
alasql('INSERT INTO one (b) VALUES ("one"), ("two")');
var res = alasql('SELECT * FROM one');
// returns [{"a":1,"b":"one"},{"a":2,"b":"two"}]
Try this example in jsFiddle
By default AlaSQL the initial value is 1 and th step is 1, but you can change it:
alasql('CREATE TABLE one (a INT IDENTITY(10,5), b STRING)');
See also: DEFAULT
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo