vendredi 19 février 2016

Time comparison in sqlite

I have classrooms table in sqlite database.

CREATE TABLE classrooms (
id              INTEGER  NOT NULL
                         PRIMARY KEY AUTOINCREMENT,
day             VARCHAR  NOT NULL,
[from]          TIME     NOT NULL,
[to]            TIME     NOT NULL,
created_at      DATETIME,
updated_at      DATETIME,
course_code     VARCHAR  NOT NULL,
department_code VARCHAR  NOT NULL,
room_id         INTEGER  NOT NULL,
FOREIGN KEY (
    course_code
)
REFERENCES courses (code),
FOREIGN KEY (
    department_code
)
REFERENCES departments (code),
FOREIGN KEY (
    room_id
)
REFERENCES rooms (id) 
);

I have three rows in classrooms table.And [from] column has 9:50 PM, 12:00 PM, 8:00 AM values. If i try to run this query

select "classrooms".* from "classrooms" 
where [from] between '9:20 PM' AND '10:20 PM';

It returns no results. But isn't it supposed to return the row containing 9:50 PM in the from column?

Aucun commentaire:

Enregistrer un commentaire