On 28 Jun 2018, at 12:48pm, Scott Robertson <stumpednom...@gmail.com> wrote:

> CREATE TABLE test2 (
> id INTEGER PRIMARY KEY,
> book text,
> page INTEGER
> );
>  
> INSERT INTO test2 VALUES ('Lord of the Rings', 327);
> 
> Error: table test2 has 3 columns but 2 values were supplied
> 
> INSERT INTO test2 VALUES (9, 'Lord of the Rings', 327);

In the first example you declared a three-column table but supplied two values.

In the second example you explicitly stated that you wanted to supply values 
for all the declared columns, so SQLite used the values you supplied.

To avoid this do either of the following:

    INSERT INTO test2 VALUES (NULL, 'Lord of the Rings', 327);
    INSERT INTO test2 (book, page) VALUES ('Lord of the Rings', 327);

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to