Skip to content

Instantly share code, notes, and snippets.

@mallain
Created August 15, 2011 15:59
Show Gist options
  • Save mallain/1147060 to your computer and use it in GitHub Desktop.
Save mallain/1147060 to your computer and use it in GitHub Desktop.
SQLite Tips
//Add several columns on a table
alter table tfa_data add column TEMP1 float;
alter table tfa_data add column TEMP2 float;
alter table tfa_data add column TEMP3 float;
// Update columns with randoms float (20 to 40)
update tfa_data
set temp1 = 20 + abs(random() * 0.0000000000000000020)
abs function : The abs(X) function returns the absolute value of the numeric argument X
random() : The random() function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807
See SQLite core function web site for more informations : http://www.sqlite.org/lang_corefunc.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment