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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -