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

推荐订阅源

博客园_首页
C
Cyber Attacks, Cyber Crime and Cyber Security
GbyAI
GbyAI
V
V2EX
M
MIT News - Artificial intelligence
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
量子位
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
H
Help Net Security
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
爱范儿
爱范儿
雷峰网
雷峰网
博客园 - 叶小钗
宝玉的分享
宝玉的分享
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
D
DataBreaches.Net
PCI Perspectives
PCI Perspectives
Martin Fowler
Martin Fowler
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
O
OpenAI News
Latest news
Latest news
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Attack and Defense Labs
Attack and Defense Labs
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
Help Net Security
Help Net Security
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
N
Netflix TechBlog - Medium
L
LINUX DO - 最新话题
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
Scott Helme
Scott Helme

SQLite

SQLite 开启 WAL 后,我的同步服务吞吐量提升了 3 倍 分享适合高并发场景的 SQLite 设置 - V2EX 在什么情况下一定要放弃 SQLite 采用 MySQL 呢? - V2EX SQLite 背后的故事 - V2EX 应该怎么理解 rowid 在 sqlite 中的使用 - V2EX macOS 上有什么好用的 SQLite GUI ? - V2EX SQLite In-Memory 作为数据缓存代替 Java Object - V2EX 什么时候调用 sqlite.close()呢 - V2EX 回复“什么场景下用 SQLite”的主题并分享一个年收入 60 万刀的技术栈 - V2EX 大家有用 Sqlite 的吗,都是什么场景下要用这个,能说一两点非要用它的理由最好啦 SQLite Viewer Web App - V2EX 本地数据库 除了 SQLite 还有什么好用的. - V2EX 请教一个方案,边缘设备的 sqlite 数据如何才能获取到 - V2EX 有人知道怎么在 termux 上编译 sqlcipher 吗? 求一个数据库设计问题! - V2EX SQLite 被曝漏洞,影响范围很大 - V2EX 两个读写 SQLite 数据库的浏览器扩展 - V2EX How SQLite is tested 如果需要寫入數據, 不僅數據文件要有寫入權限, 數據文件所在的目錄也要有寫入權限 - V2EX 用sqlite3作为论坛的数据库行不行? 如何把一个2G的sqlite数据库分割成小的? - V2EX Base 2.0 - V2EX
About Sqlite 之前的一篇笔记 - V2EX
jyoe · 2012-04-25 · via SQLite

About Sqlite
1001 wget http://www.sqlite.org/sqlite-autoconf-3071100.tar.gz
1002 tar zxvf sqlite-autoconf-3071100.tar.gz
1003 cd sqlite-autoconf-3071100
1008 ./configure
1009 make
1010 make install

sqlite3 test // 没有就创建这个db 有了就进入该db 我靠 好灵巧
木有show tables; 但可以用.tables or .table
木有show databases; 但有.databases;
sqlite> .schema
CREATE TABLE user(id integer primary key,username text ,country text);
CREATE TABLE user_card(id integer primary key,username text ,country text);
sqlite> .schema user
CREATE TABLE user(id integer primary key,username text ,country text);

这让show create table xxx 情何以堪...

order by 啥的还都正常

DataType可怜 但精巧够用
NULL
INTEGER
REAL
TEXT
BLOB
但貌似也支持date time啥的这些常规Type

About Create Index
CREATE [UNIQUE] INDEX index-name
ON [database-name .] table-name (column-name [, column-name]*)
[ON CONFLICT conflict-algorithm]

Query:
SELECT [ALL | DISTINCT] result [FROM table-list]
[WHERE expr]
[GROUP BY expr-list]
[HAVING expr]
[compound-op select]*
[ORDER BY sort-expr-list]
[LIMIT integer [(OFFSET|,) integer]]

sqlite3也接受如下的数据类型:
smallint 16 位元的整数。
interger 32 位元的整数。
decimal(p,s) p 精确值和 s 大小的十进位整数,精确值p是指全部有几个数(digits)大小值,s是指小数点後有几位数。如果没有特别指定,则系统会设为 p=5; s=0 。
float 32位元的实数。
double 64位元的实数。
char(n) n 长度的字串,n不能超过 254。
varchar(n) 长度不固定且其最大长度为 n 的字串,n不能超过 4000。
graphic(n) 和 char(n) 一样,不过其单位是两个字元 double-bytes, n不能超过127。这个形态是为了支援两个字元长度的字体,例如中文字。
vargraphic(n) 可变长度且其最大长度为 n 的双字元字串,n不能超过 2000
date 包含了 年份、月份、日期。
time 包含了 小时、分钟、秒。
timestamp 包含了 年、月、日、时、分、秒、千分之一秒。

Sqlite Datetime
sqlite> SELECT strftime('%Y/%m/%d', '2004-10-31');
2004/10/31
sqlite> SELECT strftime('%Y/%m/%d', datetime());
2012/04/05

sqlite> SELECT strftime('%Y-%m-%d %H:%M:%S', datetime());
2012-04-05 03:02:57

sqlite> SELECT strftime('%Y-%m-%d %H:%M:%S day of the week:%w Week of year:%W', datetime());
2012-04-05 03:04:52 day of the week:4 Week of year:14

// %w Day of week, 0-6 (0 is Sunday)

SELECT strftime('%H:%M:%S',time(), '+1 hours'); // 一个小时之后
SELECT strftime('%Y-%m-%d %H:%M:%S',datetime(),'+1 years'); //一年之后
SELECT strftime('%Y-%m-%d %H:%M:%S',datetime(),'+1 hours','+1 years'); // 一年之后的这一天的一小时以后
SELECT datetime('now', 'start of month'); // 2012-04-01 00:00:00 这个月的第一天 month可以改成年
SELECT time('12:00', 'localtime');
SELECT time('12:00', 'utc');