如何在SQLite 3表中插入多行? [英] How to insert multiple rows into a SQLite 3 table?

查看:100
本文介绍了如何在SQLite 3表中插入多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中,我会使用

In MySQL I'd use

INSERT INTO `mytable` (`col1`, `col2`) VALUES
  (1, 'aaa'),
  (2, 'bbb');

但这会导致SQLite错误。 SQLite的正确语法是什么?

but this causes an error in SQLite. What is the correct syntax for SQLite?

推荐答案

在此之前,这里已经回答过:是否可以一次在SQLite中插入多行数据库?

This has already been answered before here: Is it possible to insert multiple rows at a time in an SQLite database?

要回答对OMG Ponies的评论,请回答:

To answer your comment to OMG Ponies answer:

从3.7版开始。 11 SQLite支持多行插入。理查德·希普(Richard Hipp)评论:

As of version 3.7.11 SQLite does support multi-row-insert. Richard Hipp comments:

"The new multi-valued insert is merely syntactic suger (sic) for the compound insert. 
There is no performance advantage one way or the other."

这篇关于如何在SQLite 3表中插入多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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