T
T
tytar2015-10-26 23:50:57
SQL
tytar, 2015-10-26 23:50:57

SQLITE WHERE not returning anything?

Sqlite base. I wrote queries from python, debugged for a long time, and eventually came to the conclusion that sqlite itself does not return anything. The query I write from the console
SELECT task, status FROM todo WHERE id = 1;
does not return anything, but queries like
SELECT task, status FROM todo WHERE 1;
this return all records from the table
Here is the table dump

CREATE TABLE todo (id int PRIMARY KEY, task char(100) NOT NULL, status bool NOT NULL);
INSERT INTO todo (task,status) VALUES ('Read A-byte-of-python to get a good introduction into Python',0);
INSERT INTO todo (task,status) VALUES ('Visit the Python website',1);
INSERT INTO todo (task,status) VALUES ('Test various editors for and check the syntax highlighting',1);
INSERT INTO todo (task,status) VALUES ('Choose your favorite WSGI-Framework',0);

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrew, 2015-10-26
@R0dger

What about the table structure? Do you have id? is there an entry with id = 1?

N
nirvimel, 2015-10-27
@nirvimel

Yours:
equivalent
to equivalent
SELECT task, status FROM todo;

N
nozzy, 2015-10-27
@nozzy

After creating the table, try:
UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='todo';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question