日期:2014-05-16  浏览次数:20875 次

SQLITE在linux下的简单使用

1.第一步:安装sqlite   命令: sudo apt-get install sqlite,安装完成后出现下列信息则表示成功

正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  libfolks-telepathy25 ubuntuone-control-panel libpurple0 gir1.2-totem-1.0 gwibber-service telepathy-salut libgtkspell-3-0 python-dirspec
  libfolks-eds25 gir1.2-ubuntuoneui-3.0 ubuntuone-couch libindicate-gtk3 python-ubuntuone-control-panel system-config-printer-udev totem-common
  libtotem0 php5-gd telepathy-indicator nautilus-sendto-empathy libmission-control-plugins0 avahi-utils libfolks25 guile-1.8-libs duplicity
  libgwibber-gtk2 folks-common libmcrypt4 libnice10 libgssdp-1.0-3 telepathy-haze libubuntuoneui-3.0-1 gwibber-service-twitter libavahi-gobject0
  libgwibber2 libtelepathy-logger2 libtelepathy-farstream2 python-smbc system-config-printer-common gnome-games-data telepathy-mission-control-5
  telepathy-logger telepathy-gabble gwibber-service-identica python-gnomekeyring php5-mcrypt gstreamer0.10-nice python-libproxy
  python-egenix-mxdatetime libgupnp-1.0-4 libpurple-bin python-egenix-mxtools libmeanwhile1 libzephyr4 php5-mysql dbconfig-common
  gwibber-service-facebook python-cupshelpers librsync1 libfarstream-0.1-0 gir1.2-totem-plparser-1.0 libgupnp-igd-1.0-4 empathy-common
使用'apt-get autoremove'来卸载它们
将会安装下列额外的软件包:
  libsqlite0
建议安装的软件包:
  sqlite-doc
下列【新】软件包将被安装:
  libsqlite0 sqlite
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 7 个软件包未被升级。
需要下载 201 kB 的软件包。
解压缩后会消耗掉 495 kB 的额外空间。
您希望继续执行吗?[Y/n]y
获取:1 http://cn.archive.ubuntu.com/ubuntu/ precise/universe libsqlite0 i386 2.8.17-7fakesync1build1 [185 kB]
获取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/universe sqlite i386 2.8.17-7fakesync1build1 [16.8 kB]
下载 201 kB,耗时 0秒 (446 kB/s)  
Selecting previously unselected package libsqlite0.
(正在读取数据库 ... 系统当前共安装有 164881 个文件和目录。)
正在解压缩 libsqlite0 (从 .../libsqlite0_2.8.17-7fakesync1build1_i386.deb) ...
Selecting previously unselected package sqlite.
正在解压缩 sqlite (从 .../sqlite_2.8.17-7fakesync1build1_i386.deb) ...
正在处理用于 man-db 的触发器...
正在设置 libsqlite0 (2.8.17-7fakesync1build1) ...
正在设置 sqlite (2.8.17-7fakesync1build1) ...
正在处理用于 libc-bin 的触发器...
ldconfig deferred processing now taking place
felayman@felayman-Inspiron-N4050:~$ sqlite3

2.简单使用安装说明:SQLite version 2.8.17
Enter ".help" for instructions
sqlite> 

我这是2.8.17版本 按照其建议使用命令:.help  出现下列信息

.databases             List names and files of attached databases
.dump ?TABLE? ...      Dump the database in a text format
.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.
.header(s) ON|OFF      Turn display of headers on or off
.help                  Show this message
.indices TABLE         Show names of all indices on TABLE
.mode MODE             Set mode to one of "line(s)", "column(s)", 
                       "insert", "list", or "html"
.mode insert TABLE     Generate SQL insert statements for TABLE
.nullvalue STRING      Print STRING instead of nothing for NULL data
.output FILENAME       Send output to FILENAME
.output stdout         Send output to the screen
.prompt MAIN CONTINUE  Replace the standard prompts
.quit &nb