加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

sqlite3 命令行操作

发布时间:2020-12-12 23:56:19 所属栏目:百科 来源:网络整理
导读:sqlite3 命令行操作 1. sqlite3 dbName.sqlite3 加载数据库,不存载就创建 2. .help 帮助详解 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 span style= "color:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 <span style="color: #ff0000;">sqlite> .help </span>.backup ?DB? FILEBackup (default "main") to FILE .bail ON|OFFStop after hitting an error. Default OFF .databases List names andfiles of attached databases .dump ?TABLE? ... Dump the database inan SQLtext formatIf specified,only dump tables matchingLIKEpattern . .echo Turn command echo on oroff .exit Exit this program .explain ?? Turn output mode suitable forEXPLAINon off. With no args,it turns on. .header(s) Turn display of headers on off .help Show this message .import FILEImport data from into TABLE .indices ?? Show names of all indicesfortables matching . .load ?ENTRY? Load an extension library .log |off Turn logging on off. can be stderr/stdout .mode MODE? Set output mode where is one of: csv Comma-separated values column Left-aligned columns. (See .width) html HTML<table> code insert insert statements TABLE line One value per line list Values delimited by .separator string tabs Tab-separated values tcl TCLlist elements .nullvalue STRINGPrint STRINGplace of NULLvalues .output FILENAMESend output to FILENAME .output stdout Send output to the screen .prompt MAINCONTINUEReplace the standard prompts .quit Exit this program .read Execute SQLinFILENAME .restore ?Restore content of ) from FILE .schema ?? Show the CREATEstatements . .separator Change separator used by output mode .import .show Show the current values various settings .stats Turn stats on off .tables ?? List names of tables . .timeout MSTry opening locked tables milliseconds .width NUM1NUM2... Set column widths for"column"mode .timer Turn the CPUtimer measurement on off

3. 应用截图

加载

root@ubuntu:~/workspace/SVN_AUTH/db# sqlite3 development.sqlite3 SQLite version 3.72 Enter ".help"instructions Enter statements terminated with a ";"

显示数据库

4 sqlite> .databases seq name file --- --------------- ----------------------------------------------------------0main /root/workspace//db/development.sqlite3

显示表

sqlite> .tables applies logs repositories users deps permits schema_migrations

显示表的内容

sqlite> .head on #显示表头 sqlite> select * from users; id|name|brief|group|dep_id|created_at|updated_at13B-16刘文民|liuwm|superadmin||20110808:1137283136283136 3D01贾延平|jiayp|admin||1951745947745947 4杜宏伟|duhw|||33496746496746 5214苑辰|yuanc-a|emplooyee||5203229173229173 6周四维|zhousw|||5421134175134175 12施晟|shis|||56234077234077

显示创建表的脚本(不跟参数显示所有的)

8 sqlite> select * from users; id|name|brief|group|dep_id|created_at|updated_at 283136 745947 496746 229173 134175 234077

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

sqlite3 命令行操作

1. sqlite3 dbName.sqlite3 加载数据库,不存载就创建

2. .help 帮助详解

    推荐文章
      热点阅读