sqlite - Default column value during and after adding a column -


if specify default when adding non-null column table ...

alter table foo add column bar int default 42 not null 

... bar column continue have default value? or default used while adding column, specify values in existing rows?

the documentation says:

the column-def rule defines characteristics of new column.

so default value applies column, not operation:

sqlite> create table foo(x); sqlite> alter table foo add column bar int default 42 not null; sqlite> insert foo(x) values(1); sqlite> select * foo; 1|42 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -