我在sqlite3数据库中有一个表格路径(处理架构为:
的自行车道)CREATE TABLE trails (ID integer primary key, name text, city text, state char(2), length integer, ascent integer, difficulty char(2), description text);
然后我尝试在其中插入一个值:
INSERT INTO trails (name, city, state, length, ascent, difficulty, description) VALUES (‘Blue'Sky’,‘Fort Collins’,‘CO’, 6, 300, ‘bg’, ‘cool trail’);
我认为数据类型文本会使用任何类型的字符串(即使是带字符串的字符串,例如段落)。出了什么问题?
答案 0 :(得分:2)
字符串的字符可以是单引号'
或双引号"
。当字符串包含单引号时使用双引号。
CREATE TABLE trails (ID integer primary key, name text, city text, state char(2), length integer, ascent integer, difficulty char(2), description text);
INSERT INTO trails (name, city, state, length, ascent, difficulty, description) VALUES ("Blue'Sky","Fort Collins","CO", 6, 300, "bg", "cool trail");