sql - ADD vs. ADD COLUMN in SQLite? -


i trying add new column pre-existing table on database upgrade method. i've seen 2 ways:

alter table foo add new_column integer default 0

and

alter table foo add column new_column integer default 0

what's difference?

the column keyword optional. no difference @ all.

try following script:

create table test (     col1 integer );  insert test (col1) values (1);  alter table test  add col2 integer null;  alter table test  add column col3 integer null;  select *  test 

the result be:

col1    col2    col3 1 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -