深入SQLite一:简介


SQLite,是一款轻型的数据库,是遵守ACID的关联式数据库管理系统,它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了。它能够支持Windows/Linux/Unix等等主流的操作系统,同时能够跟很多程序语言相结合,比如Tcl、C#、PHP、Java等,还有ODBC接口,同样比起Mysql、PostgreSQL这两款开源世界著名的数据库管理系统来讲,它的处理速度比他们都快。SQLite第一个Alpha版本诞生于2000年5月。 至今已经有12个年头,SQLite也迎来了一个版本 SQLite 3已经发布。


SQLite官方主页
http://www.sqlite.org/

下载地址: 
http://www.sqlite.org/download.html
for 32-bit Windows (.NET Framework 4.0) 

http://system.data.sqlite.org/downloads/1.0.82.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe

GUI客户端:
Sqliteman   http://sqliteman.com/

下载:http://sourceforge.net/project/platformdownload.php?group_id=189610

基本命令:


D:\>sqlite3 database.db
sqlite> create table cnblogs(user text, fans integer);
sqlite> insert into cnblogs values('txw1958',36);
sqlite> select * from cnblogs;
sqlite> update cnblogs set fans=100 where user='txw1958';
sqlite> delete from cnblogs where user='txw1958';
sqlite> select * from cnblogs;
sqlite> drop table cnblogs;


SQLite系统命令

sqlite> .help
.backup ?DB? FILE      Backup DB (default "main") to FILE(备份数据库到文件)
.bail ON|OFF           Stop after hitting an error.  Default OFF(遇到错误退出,默认关闭)
.databases             List names and files of attached databases (查看目前挂的数据库的名字与文件)
.dump ?TABLE? ...      Dump the database in an SQL text format(以SQL格式输出表结构)
                         If TABLE specified, only dump tables matching
                         LIKE pattern TABLE.
.echo ON|OFF           Turn command echo on or off 打开/关闭命令行回显
.exit                  Exit this program(退出程序)
.explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.
                         With no args, it turns EXPLAIN on.
.header(s) ON|OFF      Turn display of headers on or off 打开|关闭头显示
.help                  Show this messfans(显示帮助信息)
.import FILE TABLE     Import data from FILE into TABLE(把文件中的数据导入到表中,各字段用separator的值为分隔符)
.indices ?TABLE?       Show names of all indices 显示索引名字
                         If TABLE specified, only show indices for tables
                         matching LIKE pattern TABLE.
.load FILE ?ENTRY?     Load an extension library 加载扩展库
.log FILE|off          Turn logging on or off.  FILE can be stderr/stdout 打开|关闭日志记录
.mode MODE ?TABLE?     Set output mode where MODE is one of: (设置输出格式)
                         csv      Comma-separated values (各字段以逗号为分隔符输出)
                         column   Left-aligned columns.  (See .width)(以.width设置的宽度显示各字段)
                         html     HTML <table> code (html表格格式输出)
                         insert   SQL insert statements for TABLE (以insert SQL语句形式输出)
                         line     One value per line (field = value的形式逐行输出)
                         list     Values delimited by .separator string (各字段以separator的值为分隔符输出)
                         tabs     Tab-separated values
                         tcl      TCL list elements
.nullvalue STRING      Print STRING in place of NULL values (输出字符串取代空值)
.output FILENAME       Send output to FILENAME (设置输出到文件)
.output stdout         Send output to the screen (设置输出到屏幕,默认)
.prompt MAIN CONTINUE  Replace the standard prompts (修改提示符)
.quit                  Exit this program  (修改分隔符)
.read FILENAME         Execute SQL in FILENAME (执行文件中的SQL)
.restore ?DB? FILE     Restore content of DB (default "main") from FILE 
.schema ?TABLE?        Show the CREATE statements
                         If TABLE specified, only show tables matching
                         LIKE pattern TABLE.
.separator STRING      Change separator used by output mode and .import (改变输出模式分隔符)
.show                  Show the current values for various settings (显示各项配置信息)
.stats ON|OFF          Turn stats on or off 
.tables ?TABLE?        List names of tables (列出表名)
                         If TABLE specified, only list tables matching
                         LIKE pattern TABLE.
.timeout MS            Try opening locked tables for MS milliseconds (超时时间,单位:毫秒)
.width NUM1 NUM2 ...   Set column widths for "column" mode(设置列宽)
.timer ON|OFF          Turn the CPU timer measurement on or off
sqlite>


转载于:https://my.oschina.net/haigou20/blog/159055

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值