隨筆 - 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 小一敗涂地 閱讀(3261) 評論(0)  編輯  收藏 所屬分類: android+移動開發

          主站蜘蛛池模板: 会泽县| 凤山市| 青铜峡市| 时尚| 乌鲁木齐县| 合山市| 天全县| 昔阳县| 伊宁县| 德惠市| 寿光市| 宝兴县| 吴旗县| 澄迈县| 壶关县| 霸州市| 凌海市| 霍林郭勒市| 乐平市| 抚宁县| 宜川县| 新密市| 抚远县| 韩城市| 玉门市| 溧水县| 昭苏县| 泗水县| 沙田区| 衡阳县| 博客| 广昌县| 工布江达县| 咸宁市| 治多县| 柏乡县| 兴隆县| 通河县| 澄迈县| 自贡市| 乐山市|