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