我在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’);我认为数据类型文本将接受给定的任何类型的字符串(即使是带有字符串的字符串,比如段落)。出什么问题了?
发布于 2016-03-25 23:29:43
字符串的字符可以是单引号'或双引号"。当字符串包含单引号时使用双引号。
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");https://stackoverflow.com/questions/36229626
复制相似问题