Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread Robert M. Münch
On 29 Jun 2017, at 19:06, Jens Alfke wrote: >> On Jun 29, 2017, at 12:13 AM, Hick Gunter wrote: >> >> Double quotes is specifically for building identifiers that "look strange" >> (i.e. embedded spaces, keywords, ...) which IMHO should be avoided because >> it tends to clutter up the statement.

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread Jens Alfke
> On Jun 29, 2017, at 12:13 AM, Hick Gunter wrote: > > Double quotes is specifically for building identifiers that "look strange" > (i.e. embedded spaces, keywords, ...) which IMHO should be avoided because it > tends to clutter up the statement. I agree that if you’re generating the schema b

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread Peter da Silva
On 6/29/17, 5:20 AM, "sqlite-users on behalf of R Smith" wrote: > SQLite isn't helping the confusion in this case, because it allows > double-quotes to be regarded as string values IF an identifier with that name > doesn't exist. This is of course all good and well until you misspell a > colu

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread Peter da Silva
On 6/29/17, 1:22 AM, "sqlite-users on behalf of Robert M. Münch" wrote: > Hi, sorry, should have mentioned that this doesn't work in my case, because > we are building the column placeholders dynamically. So, we would have to > handle putting the necessary column names in there all the time, wh

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread R Smith
On 2017/06/29 8:15 AM, Robert M. Münch wrote: On 27 Jun 2017, at 22:11, David Raymond wrote: Single quotes should be used for strings, so DEFAULT '-' I thought it doesn't matter if I use " or ' for strings. What's the difference? I had this misconception at some point too. Double quotes ar

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-29 Thread Hick Gunter
id integer -- -- 1 integer -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Robert M. Münch Gesendet: Donnerstag, 29. Juni 2017 08:16 An: SQLite mailing list Betreff: Re: [sqlite] INSERT ... VA

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Clemens Ladisch
Robert M. Münch wrote: > Is this behaviour standard or a SQLite variant? Autoincrementing is an SQLite variant. Default values are standard SQL. It should be noted that standard SQL (above Entry SQL level) allows DEFAULT in row value constructors. Regards, Clemens __

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Robert M. Münch
On 28 Jun 2017, at 14:51, Simon Slavin wrote: > Really ? In that case I withdraw my previous answer. I thought that NULLs > were converted to the default value for a column (which is usually NULL but > can be overridden with a DEFAULT clause). I had exactly the same understanding. BTW: Is thi

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Robert M. Münch
On 28 Jun 2017, at 9:49, Maks Verver wrote: > I'm surprised nobody mentioned that you can specify the columns to be > inserted in the query: > > INSERT INTO test(a, c, d) VALUES (1, 2 3); > > (Note that `b` is missing it `a, c, d`. It will take the default value, > which will be NULL, unless a d

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Robert M. Münch
On 27 Jun 2017, at 22:24, David Raymond wrote: > If you have to provide 4 values then the way you can use null to do that is > to add in a trigger to set the default, since NULL _is_ a value and _is_ > legal for that field. Ha, that's a very good idea. I didn't have triggers in the radar. Great

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Robert M. Münch
On 27 Jun 2017, at 22:11, David Raymond wrote: > Single quotes should be used for strings, so DEFAULT '-' I thought it doesn't matter if I use " or ' for strings. What's the difference? > So there is no method to do something like... > > INSERT INTO test VALUES ('field a', DEFAULT, 'field c', '

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Bond, Liz
lite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Maks Verver Sent: 28 June 2017 08:50 To: SQLite mailing list Subject: Re: [sqlite] INSERT ... VALUES / want to "skip" default values I'm surprised nobody mentioned that you can specify the columns to be inserted

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Petite Abeille
> On Jun 28, 2017, at 4:15 PM, R Smith wrote: > > I did ponder whether it would be a nice "feature" to use the default if both > a DEFAULT and a NOT NULL constraint existed on a column - but then again, > that will go against strict design principles and can cause a lot of > confusion later.

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Scott Robison
On Jun 28, 2017 6:51 AM, "Simon Slavin" wrote: On 28 Jun 2017, at 9:45am, Clemens Ladisch wrote: > An explicit NULL works only for the autoincrement column, but not for default values. Really ? In that case I withdraw my previous answer. I thought that NULLs were converted to the default v

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread R Smith
On 2017/06/28 2:51 PM, Simon Slavin wrote: An explicit NULL works only for the autoincrement column, but not for default values. Really ? In that case I withdraw my previous answer. I thought that NULLs were converted to the default value for a column (which is usually NULL but can be ove

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Simon Slavin
On 28 Jun 2017, at 9:45am, Clemens Ladisch wrote: > An explicit NULL works only for the autoincrement column, but not for default > values. Really ? In that case I withdraw my previous answer. I thought that NULLs were converted to the default value for a column (which is usually NULL but

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Clemens Ladisch
Simon Slavin wrote: > On 27 Jun 2017, at 8:13pm, Robert M. Münch > wrote: >> CREATE TABLE test(a, b DEFAULT "-", c, d) >> >> Now I would like to use >> >> INSERT VALUES(a,?,c,d) >> >> Where ? is something that the default value is used and not the provided >> value. Is this possible at all? > >

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-28 Thread Maks Verver
; a b c d > -- -- -- -- > field a - field c field d > > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Simon Slavin > Sent: Tuesday, Ju

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-27 Thread David Raymond
: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin Sent: Tuesday, June 27, 2017 4:08 PM To: SQLite mailing list Subject: Re: [sqlite] INSERT ... VALUES / want to "skip" default values On 27 Jun 2017, at 8:13pm, Robert M. Münch wrote: > CREAT

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-27 Thread David Raymond
Single quotes should be used for strings, so DEFAULT '-' Not quite sure what you're asking. Do you mean how to insert defaults in general? INSERT INTO test (a, c, d) VALUES ('field a', 'field c', 'field d'); will get you a b c d -- -- -- -

Re: [sqlite] INSERT ... VALUES / want to "skip" default values

2017-06-27 Thread Simon Slavin
On 27 Jun 2017, at 8:13pm, Robert M. Münch wrote: > CREATE TABLE test(a, b DEFAULT "-", c, d) > > Now I would like to use > > INSERT VALUES(a,?,c,d) > > Where ? is something that the default value is used and not the provided > value. Is this possible at all? You provide the text "NULL" (n