隨筆 - 0, 文章 - 264, 評論 - 170, 引用 - 0
          數據加載中……

          Android之sqlite 命令

          Android之sqlite 命令

          1.數據庫、表的建立,記錄的添加、查詢、修改和刪除

          F:">sqlite3 database.db
          sqlite> create table admin(username text,age integer);
          sqlite> insert into admin values('kuang',25);
          sqlite> select * from admin;
          sqlite> update admin set username='kk',age=24 where username='kuang' and age=25;
          sqlite> delete from admin where username='kk';

          注:每條sql語句后必須以";"號結尾!

          2.Sqlite系統命令

          .bail ON|OFF           Stop after hitting an error.  Default OFF
          .databases             List names and files of attached databases(查看目前掛的數據庫)
          .dump ?TABLE? ...      Dump the database in an SQL text format(以SQL格式輸出表結構)
          .echo ON|OFF           Turn command echo on or off
          .exit                  Exit this program(退出程序)
          .explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
          .header(s) ON|OFF      Turn display of headers on or off
          .help                  Show this message(顯示幫助信息)
          .import FILE TABLE     Import data from FILE into TABLE(把文件中的數據導入到表中,各字段用separator的值為分隔符)
          .indices TABLE         Show names of all indices on TABLE
          .load FILE ?ENTRY?     Load an extension library
          .mode MODE ?TABLE?     Set output mode where MODE is one of:(輸出格式)
                                   csv      Comma-separated values(各字段以逗號為分隔符輸出)
                                   column   Left-aligned columns.  (See .width)(以.width設置的寬度顯示各字段)
                                   html     HTML <table> code(html表格格式輸出)
                                   insert   SQL insert statements for TABLE(以insert SQL語句形式輸出)
                                   line     One value per line(field = value的形式逐行輸出)
                                   list     Values delimited by .separator string(各字段以separator的值為分隔符輸出)
                                   tabs     Tab-separated values
                                   tcl      TCL list elements
          .nullvalue STRING      Print STRING in place of NULL values
          .output FILENAME       Send output to FILENAME(設置把查詢輸出到文件,后面的輸出結果都保存到文件中)
          .output stdout         Send output to the screen(設置把查詢結果輸出到屏幕,默認)
          .prompt MAIN CONTINUE  Replace the standard prompts(修改提示符)
          .quit                  Exit this program(退出)
          .read FILENAME         Execute SQL in FILENAME(執行文件中的SQL語句)
          .schema ?TABLE?        Show the Create statements(以SQL格式輸出表結構)
          .separator STRING      Change separator used by output mode and .import(修改分隔符)
          .show                  Show the current values for various settings(顯示配置信息)
          .tables ?PATTERN?      List names of tables matching a LIKE pattern(看看有創建了多少表)
          .timeout MS            Try opening locked tables for MS milliseconds(超時時間,單位:毫秒)
          .width NUM NUM ...     Set column widths for "column" mode(設置列寬)

          posted on 2010-10-22 14:13 小一敗涂地 閱讀(3260) 評論(0)  編輯  收藏 所屬分類: android+移動開發

          主站蜘蛛池模板: 报价| 墨竹工卡县| 织金县| 平昌县| 乌拉特前旗| 万年县| 环江| 夏河县| 高唐县| 开江县| 深州市| 四平市| 黎川县| 兰溪市| 乐陵市| 曲沃县| 朔州市| 上蔡县| 荆州市| 余干县| 石狮市| 江源县| 西贡区| 易门县| 彰化县| 固始县| 鄄城县| 河北省| 沽源县| 武义县| 哈巴河县| 土默特右旗| 昌乐县| 道真| 磐安县| 会东县| 商南县| 齐齐哈尔市| 长寿区| 天气| 海伦市|