SQLite 插入问题 – 错误:没有这样的列 [英] SQLite insert issue – Error: no such column

查看:31
本文介绍了SQLite 插入问题 – 错误:没有这样的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 SQLite 时遇到了问题(如果有问题,请使用 3.7.13 版).

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

我创建了一个包含两列 foo 和 bar 的新表,数据类型未定义.当我尝试插入数字时,它工作正常.当我插入文本时,会发生错误:没有这样的列".

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

我做错了什么?

谢谢.

推荐答案

你需要引用字符串

insert into test values('a', 'b')

这篇关于SQLite 插入问题 – 错误:没有这样的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆