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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
小众软件
小众软件
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
B
Blog
量子位
B
Blog RSS Feed
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Jina AI
Jina AI
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG

SQLite

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