sql - sqlite insert with default values for default fields -


the docs specify 2 alternatives: insert values or insert default values (https://www.sqlite.org/lang_insert.html)

the trouble if 1 example has table:

create table address_book values(  rowid integer primary key,   first_name,   last_name,   address,   phone_number,   email, notes,   country text default 'usa'  ) 

one can no longer write insert values(?, ?, ?, ?, ?, ?) since expects rowid , country specified. there shortcut specifying insert values default values populating default fields? or impossible without explicitly naming non-default fields?

yes, impossible. in event practice explicitly name columns inserting anyway -- leaving columns out leads more fragile code , more "silent failure" possibilities in you're not inserting data column think inserting into.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -