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://www.f2er.com/sqlite/201067.html