一些很有用的SQLite命令總結
顯示表結構:
復制代碼 代碼如下:
sqlite> .schema [table]
獲取所有表和視圖:
復制代碼 代碼如下:
sqlite > .tables
獲取指定表的索引列表:
復制代碼 代碼如下:
sqlite > .indices [table ]
導出數(shù)據(jù)庫到 SQL 文件:
復制代碼 代碼如下:
sqlite > .output [filename ]
sqlite > .dump
sqlite > .output stdout
從 SQL 文件導入數(shù)據(jù)庫:
復制代碼 代碼如下:
sqlite > .read [filename ]
格式化輸出數(shù)據(jù)到 CSV 格式:
復制代碼 代碼如下:
sqlite >.output [filename.csv ]
sqlite >.separator ,
sqlite > select * from test;
sqlite >.output stdout
從 CSV 文件導入數(shù)據(jù)到表中:
復制代碼 代碼如下:
sqlite >create table newtable ( id integer primary key, value text );
sqlite >.import [filename.csv ] newtable
備份數(shù)據(jù)庫:
復制代碼 代碼如下:
/* usage: sqlite3 [database] .dump > [filename] */
sqlite3 mytable.db .dump > backup.sql
恢復數(shù)據(jù)庫:
復制代碼 代碼如下:
/* usage: sqlite3 [database ] < [filename ] */
sqlite3 mytable.db < backup.sql
相關文章:
1. SQLite教程(四):內置函數(shù)2. SQLite數(shù)據(jù)庫常用語句及MAC上的SQLite可視化工具MeasSQLlite使用方法3. sqlite時間戳轉時間語句(時間轉時間戳)4. SQLite 實現(xiàn)if not exist 類似功能的操作5. mysql命令行客戶端結果分頁瀏覽6. DB2數(shù)據(jù)庫命令行處理器中的語句執(zhí)行問題7. 初識SQLITE3數(shù)據(jù)庫8. Sqlite數(shù)據(jù)庫里插入數(shù)據(jù)的條數(shù)上限是5009. MySQL數(shù)據(jù)庫基礎入門之常用命令小結10. SQLite3的綁定函數(shù)族使用與其注意事項詳解

網(wǎng)公網(wǎng)安備