一、登陆css
sqlite da_namesql
二、查看数据库和表数据库
.databasescode
.tablessqlite
三、查看表结构it
.schema tablenameio
四、导入数据到sqlitetable
- sqlite> .separator ","
- sqlite> .import data.txt data_txt_table
- sqlite> select * from data_txt_table;
- id,name,age,address,hobby
- 1,tom,24,beijing,football
- 2,liu,27,heibei,fotball
- 3,jim,26,shandong,football
- 4,han,28,beijing,football
- 5,meng,25,beijing,tennis
- sqlite>
五、数据导出class
数据导出也是一个经常使用到的操做,能够将指定表中的数据导出成SQL脚本,供其余数据库使用,还能够将指定的数据表中的数据完整定位到标准输出,也能够将指定数据库中的数据完整的导入到另外一个指定数据库等,
1. 导出成指定的SQL脚本
将sqlite中指定的数据表以SQL建立脚本的形式导出,具体命令
test
- ywx@ywx:~/yu/sqlite$ sqlite3 test.db
- SQLite version 3.7.7.1 2011-06-28 17:39:05
- Enter ".help" for instructions
- Enter SQL statements terminated with a ";"
- sqlite> .output data.sql
- sqlite> .dump
- sqlite>
- ywx@ywx:~/yu/sqlite$ ll
- 总计 16
- drwxr-xr-x 2 ywx ywx 4096 2011-08-13 23:15 ./
- drwxr-xr-x 7 ywx ywx 4096 2011-08-13 20:53 ../
- -rw-r--r-- 1 ywx ywx 602 2011-08-13 23:17 data.sql
- -rw-r--r-- 1 ywx ywx 2048 2011-08-13 22:44 test.db