Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite insert issue – Error: no such column

Tags:

sqlite

I faced an issue with SQLite (version 3.7.13 if matters).

I created a new table with two columns foo and bar, data type is undefined. When I try to insert numbers, it works fine. When I insert text, "Error: no such column" happens.

sqlite> CREATE TABLE test (foo, bar);
sqlite> .tables
test
sqlite> insert into test values (0,1);
sqlite> select * from test;
0|1
sqlite> insert into test values (a,b);
Error: no such column: a

What am I doing wrong?

Thanks.

like image 979
arsenyinfo Avatar asked Feb 22 '14 18:02

arsenyinfo


1 Answers

You need to quote strings

insert into test values('a', 'b')
like image 190
Thayne Avatar answered Jan 18 '23 19:01

Thayne