惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - AK747

关于"Google限制Python"事件我的看法 - AK747 - 博客园 JsEasy简介 - AK747 - 博客园 Bjam简明教程 该Blog停止更新,新的blog地址http://www.cppblog.com/zuroc/ [原创]《程序员,在路上……》第1节——用OPENEL画出麦克斯维速率分布曲线 用程序画出麦克斯维速率分布曲线 在sourceforge看到的一段文字,由此联想到<<暴风影音>> 大一时写的诗,张沈鹏 学习SQlite-语法示例 转载-SQLite语法备忘录 作者:http://blog.csdn.net/ezdevelop/结构定义 学习+翻译《SQL As Understood By SQLite》--CREATE INDEX 学习+翻译《SQL As Understood By SQLite》--ON CONFLICT clause 【转载】事务处理的定义 [转载]SQlite 常用函数学习笔记 [转载]SQLite介绍 [转载]在 LCC 下怎样编译Sqlite 在程序中用SQlite.txt 初学SQLite数据库 我搞了一个开源的项目,网址http://akenxp.gro.clinux.org目前还是计划阶段,欢迎大家加盟。
学习+翻译《SQL As Understood By SQLite》--INSERT
AK747 · 2005-08-02 · via 博客园 - AK747
sql-statement ::= INSERT [OR conflict-algorithm] INTO [database-name .] table-name [(column-list)] VALUES(value-list) |
INSERT
[OR conflict-algorithm] INTO [database-name .] table-name [(column-list)] select-statement

The INSERT statement comes in two basic forms. The first form (with the "VALUES" keyword) creates a single new row in an existing table. If no column-list is specified then the number of values must be the same as the number of columns in the table. If a column-list is specified, then the number of values must match the number of specified columns. Columns of the table that do not appear in the column list are filled with the default value, or with NULL if not default value is specified.

The second form of the INSERT statement takes it data from a SELECT statement. The number of columns in the result of the SELECT must exactly match the number of columns in the table if no column list is specified, or it must match the number of columns name in the column list. A new entry is made in the table for every row of the SELECT result. The SELECT may be simple or compound. If the SELECT statement has an ORDER BY clause, the ORDER BY is ignored.

The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one command. See the section titled ON CONFLICT for additional information. For compatibility with MySQL, the parser allows the use of the single keyword REPLACE as an alias for "INSERT OR REPLACE".

INSERT函数有两种基本形式

1.有"VALUES"关键字

如果没有限制列,value参数的个数=表的列数;如果限制了列,value参数的个数=限制的列数,这时表中没有填充的列将为默认值(当没有默认值时为NULL)。

2.从SELECT中获取数据,数据个数限制同上。表中一行保存一个SELECT结果。同时忽略SELECT语句中的“ORDER BY”语句(该语句是干什么的,哪位高手指点一下)。

可选项[conflict-algorithm]:允许定义一个an alternative constraint conflict resolution algorithm to use during this one command(谁会翻译?)。在ON CONFLICT你可以获得更多信息。为了兼容MySQL,“REPLACE”等价于"INSERT OR REPLACE"。

另外我在网上看到以下评论:

和其它数据库不同的是 sqlite在开启事物的时候要远快于未开启的时候
原因如下:
因为sqlite的事务处理机制是通过文件锁和临时文件来实现的 并没有像其它的数据库一样加入checkpoint来进行二次提交以及多步回滚,所以在未开启事物的情况下,每次操作数据库之次sqlite都会释放文件写锁,以获得对并发的支持,而开启事物后它就不需要再考虑并发了,到事物结束前,它都一直会用写文件锁保持对数据库文件的占用,所以这个时候性能会远大于未开启事物,我做的测试,对1W条数据,未用事务,7~8s 和access相仿,开启事物,0.1~0.3S

而只是对数据读取(select)时 就不用考虑上述问题了,所以性能相差无几

所以sqlite是一个另类的数据库,它将改变我们很多时候对数据库的认识,如事务处理,物理文件设计。

想问一下,如何开启“事务处理”?
示例:INSERT INTO existWord VALUES("W")(向exsitWord的表插入“W”)