一些很有用的SQLite命令總結
更新時間:2015年07月06日 09:13:15 投稿:junjie
這篇文章主要介紹了一些很有用的SQLite命令總結,本文總結了顯示表結構、獲取所有表和視圖、獲取指定表的索引列表、導出數(shù)據(jù)庫到 SQL 文件、從 SQL 文件導入數(shù)據(jù)庫等一些非常有用的操作命令,需要的朋友可以參考下
顯示表結構:
復制代碼 代碼如下:
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
相關文章
Win11下基于VS2022編譯SQLite3源碼的實現(xiàn)步驟
本文主要介紹了Win11下基于VS2022編譯SQLite3源碼的實現(xiàn)步驟,文中通過圖文介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2023-09-09保護你的Sqlite數(shù)據(jù)庫(SQLite數(shù)據(jù)庫安全秘籍)
相信使用PHP開發(fā)的人員一定不會對SQLite感到陌生了,PHP5已經(jīng)集成了這個輕量型的數(shù)據(jù)庫。并且很多虛擬主機無論是win還是*nux都支持它。2009-08-08