Sqlite3插入语句错误

时间:2016-08-25 13:07:16

标签: sqlite sql-insert

我正在尝试将以下内容插入到我的sqlite3数据库中:

INSERT INTO candlestick_1min (timestamp, close, high, low, open, volume) 
VALUES (2016-08-11 15:30:00, 34.258, 34.318, 34.258, 34.302, 45890.0);

出于某种原因,它给了我以下错误:

Error: near "15": syntax error

架构如下:

CREATE TABLE candlestick_1min (timestamp TEXT PRIMARY KEY NOT NULL, close    REAL, high REAL, low REAL, open REAL, volume REAL);

有人可以告诉我为什么会出现这个错误吗?顺便说一下,桌子是完全空的。

1 个答案:

答案 0 :(得分:1)

将日期值放在引号''中,如

INSERT INTO candlestick_1min (timestamp, close, high, low, open, volume) 
VALUES ('2016-08-11 15:30:00', 34.258, 34.318, 34.258, 34.302, 45890.0);