2014年9月24日 星期三

SQLite quickstart: 使用指令行

安裝:sudo apt-get install sqlite3

執行
sqlite3 或 sqlite3 <file_name>
EOF (通常是 Ctrl-D) 離開
sqlite 的資料庫是存在檔案,如果執行時未指定 <file_name>,離開時暫時的資料庫會移除

輸入 SQL 指令
每個 SQL 指令以「;」結束

範例
$ sqlite3 ex1
SQLite version 3.8.5 2014-05-29 12:36:14
Enter ".help" for usage hints.
sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values('hello!',10);
sqlite> insert into tbl1 values('goodbye', 20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite>

sqlite3 特殊指令 (dot commands)
.help 列出所有 dot 指令

SQL 指令 readfile()、writefile() (非內建)可存取檔案

轉換 SQLite 資料庫
sqlite3 ex1 .dump 可輸出 SQL 成文字檔,或轉換成其它 SQL 資料庫。

參考來源
  1. Command Line Shell For SQLite

沒有留言:

張貼留言

SIP header Via

所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...