centos6.5平台上SQLite数据库教程——终端使用篇

svn: 请使用 “svn help” 以得到更多信息

[root@jike svn]# sqlite3
SQLite version 3.6.20
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite>
  
sqlite> create table stutable(sid,sname,sage);
sqlite> insert into stutable(sid,sname,sage)values(1,”jack”,”23″);
sqlite> insert into stutable(sid,sname,sage)values(2,”rose”,”21″);
sqlite> select * from stutable;
1|jack|23
2|rose|21
sqlite> update stutable set sname=”answer” where sid =1;
sqlite> select * from stutable;
1|answer|23
2|rose|21
sqlite> .mode columm
Error: mode should be one of: column csv html insert line list tabs tcl
sqlite> .mode column
sqlite> select * from stutable;
1           answer      23        
2           rose        21        
sqlite> .mode insert
sqlite> select * from stutable;
INSERT INTO table VALUES(1,’answer’,’23’);
INSERT INTO table VALUES(2,’rose’,’21’);
sqlite> .mode line
sqlite> select * from stutable;
  sid = 1
sname = answer
 sage = 23

  sid = 2
sname = rose
 sage = 21
sqlite> .separator “&&&”
sqlite> select * from stutable;
  sid = 1
sname = answer
 sage = 23

  sid = 2
sname = rose
 sage = 21
sqlite> .datebases
Error: unknown command or invalid arguments:  “datebases”. Enter “.help” for help
sqlite> .databases
seq  name             file                                                      
—  —————  ———————————————————-
0    main                                                                       
sqlite> .tables
stutable
sqlite> .show
     echo: off
  explain: off
  headers: off
     mode: line
nullvalue: “”
   output: stdout
separator: “&&&”
    width:
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE stutable(sid,sname,sage);
INSERT INTO “stutable” VALUES(1,’answer’,’23’);
INSERT INTO “stutable” VALUES(2,’rose’,’21’);
COMMIT;
sqlite> .output file

sqlite> .exit
[root@jike svn]#

    原文作者:sqlite
    原文地址: https://www.cnblogs.com/jike369/articles/9340300.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞