一些很有用的SQLite命令總結(jié)
顯示表結(jié)構(gòu):
復(fù)制代碼 代碼如下:
sqlite> .schema [table]
獲取所有表和視圖:
復(fù)制代碼 代碼如下:
sqlite > .tables
獲取指定表的索引列表:
復(fù)制代碼 代碼如下:
sqlite > .indices [table ]
導(dǎo)出數(shù)據(jù)庫到 SQL 文件:
復(fù)制代碼 代碼如下:
sqlite > .output [filename ]
sqlite > .dump
sqlite > .output stdout
從 SQL 文件導(dǎo)入數(shù)據(jù)庫:
復(fù)制代碼 代碼如下:
sqlite > .read [filename ]
格式化輸出數(shù)據(jù)到 CSV 格式:
復(fù)制代碼 代碼如下:
sqlite >.output [filename.csv ]
sqlite >.separator ,
sqlite > select * from test;
sqlite >.output stdout
從 CSV 文件導(dǎo)入數(shù)據(jù)到表中:
復(fù)制代碼 代碼如下:
sqlite >create table newtable ( id integer primary key, value text );
sqlite >.import [filename.csv ] newtable
備份數(shù)據(jù)庫:
復(fù)制代碼 代碼如下:
/* usage: sqlite3 [database] .dump > [filename] */
sqlite3 mytable.db .dump > backup.sql
恢復(fù)數(shù)據(jù)庫:
復(fù)制代碼 代碼如下:
/* usage: sqlite3 [database ] < [filename ] */
sqlite3 mytable.db < backup.sql
相關(guān)文章:
1. SQLite3中自增主鍵相關(guān)知識(shí)總結(jié)2. 新手入門 介紹ORACLE的Copy命令3. SQLite教程(四):內(nèi)置函數(shù)4. SQLite教程(三):數(shù)據(jù)表和視圖簡(jiǎn)介5. SQLite教程(六):表達(dá)式詳解6. MySQL存儲(chǔ)過程的查詢命令介紹7. Windows下在DOS用mysql命令行導(dǎo)入.sql文件8. MySQL如何使用授權(quán)命令grant9. SQLite 錯(cuò)誤碼整理10. django 將自帶的數(shù)據(jù)庫sqlite3改成mysql實(shí)例
