我正在尝试将一些行插入到sqlite数据库中,其中一些字段中包含分号。我知道有一种方法可以将分隔符从分号更改为带有DELIMITER $$的postgres中的$$,但这是否可以使用sqlite?谢谢!
这是我的代码片段(我不包括所有代码,主要是因为其余的是插入,如果我们可以让两个工作,那么我们可以让300工作):
DELIMITER $$
CREATE TABLE IF NOT EXISTS search (
title VARCHAR(255) NOT NULL,
author TEXT,
database_link VARCHAR(255)
)
INSERT INTO search VALUES
('Changes in soil microbial community structure following the abandonment of agricultural terraces in mountainous areas of Eastern Spain', 'Zornoza, R.; Guerrero, C.; Mataix-Solera, J.; Scow, K. M.; Arcenegui, V.; Mataix-Beneyto, J.', 'http://ucanr.edu/sites/superfund/files/176016.pdf'),
('Near infrared spectroscopy for determination of various physical, chemical and biochemical properties in Mediterranean soils', 'Zornoza, R.; Guerrero, C.; Mataix-Solera, J.; Scow, K. M.; Arcenegui, V.; Mataix-Beneyto, J.', 'http://ucanr.edu/sites/superfund/files/176017.pdf') $$
答案 0 :(得分:0)
没关系我弄清楚了。我的问题是多个插入,而不是分号。以下代码有效,内部甚至还有一个分号!
CREATE TABLE IF NOT EXISTS search (
title VARCHAR(255) PRIMARY KEY NOT NULL,
author TEXT,
database_link VARCHAR(255)
);
INSERT INTO search VALUES
('Changes in soil microbial community structure following the abandonment of agricultural terraces in mountainous areas of Eastern Spain', 'Zornoza, R.; Guerrero, C. Mataix-Solera, J. Scow, K. M. Arcenegui, V. Mataix-Beneyto, J.', 'link1');
INSERT INTO search VALUES
('Near infrared spectroscopy for determination of various physical, chemical and biochemical properties in Mediterranean soils', 'Zornoza, R. Guerrero, C. Mataix-Solera, J. Scow, K. M. Arcenegui, V. Mataix-Beneyto, J.', 'link2');
INSERT INTO search VALUES
('Mathematical model of Chlorella minutissima UTEX2341 growth and lipid production under photoheterotrophic fermentation conditions', 'Yang, JinShui Rasa, Ehsan Tantayotai, Prapakorn Scow, Kate M. Yuan, HongLi Hristova, Krassimira R.', 'link3');