隨筆 - 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+移動開發

          主站蜘蛛池模板: 湄潭县| 唐海县| 三亚市| 鹤岗市| 乌海市| 正阳县| 习水县| 阿城市| 会东县| 灵川县| 昭通市| 泽普县| 定州市| 娱乐| 平度市| 通城县| 江都市| 辽宁省| 屯门区| 德钦县| 阿坝县| 漳平市| 温宿县| 吴川市| 临汾市| 宁陕县| 区。| 达拉特旗| 清涧县| 黄冈市| 海原县| 友谊县| 宁远县| 玛多县| 祁门县| 沁阳市| 鄄城县| 宁强县| 高陵县| 隆安县| 沙坪坝区|