- Notifications
You must be signed in to change notification settings - Fork689
Update
Mathias Wulff edited this pageDec 15, 2025 ·11 revisions
Syntax:
UPDATE tableSET prop1= value1, ...WHERE condition
For example:
alasql("UPDATE events SET synchronized = ? WHERE name = ?",[true,event.name]);alasql('UPDATE cities SET population = population * 1.5 WHERE name LIKE "A%"');alasql('UPDATE city SET population = LEN(name) * 1000000 WHERE name LIKE "M%"');
You can use theOUTPUT clause to return the updated data (both old and new values).
// Return the new valuesalasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT INSERTED.*');// Return the old valuesalasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT DELETED.*');// Return both old and new valuesalasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT DELETED.population AS old_pop, INSERTED.population AS new_pop');
AnUPDATE statement will return the amount of rows updated by the statment.
© 2014-2026,Andrey Gershun &Mathias Rangel Wulff
Please help improve the documentation by opening a PR on thewiki repo