一、登陸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