drh | 3a88fbd | 2002-01-07 19:58:43 +0000 | [diff] [blame^] | 1 | .\" Hey, EMACS: -*- nroff -*- |
| 2 | .\" First parameter, NAME, should be all caps |
| 3 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection |
| 4 | .\" other parameters are allowed: see man(7), man(1) |
| 5 | .TH SQLITE SECTION "January 2, 2002" |
| 6 | .\" Please adjust this date whenever revising the manpage. |
| 7 | .\" |
| 8 | .\" Some roff macros, for reference: |
| 9 | .\" .nh disable hyphenation |
| 10 | .\" .hy enable hyphenation |
| 11 | .\" .ad l left justify |
| 12 | .\" .ad b justify to both left and right margins |
| 13 | .\" .nf disable filling |
| 14 | .\" .fi enable filling |
| 15 | .\" .br insert line break |
| 16 | .\" .sp <n> insert n+1 empty lines |
| 17 | .\" for manpage-specific macros, see man(7) |
| 18 | .SH NAME |
| 19 | sqlite \- A command line interface for SQLite |
| 20 | .SH SYNOPSIS |
| 21 | .B sqlite |
| 22 | .RI [ options ] " filename " [ SQL ] |
| 23 | .SS SUMMARY |
| 24 | .PP |
| 25 | sqlite is a terminal-based front-end to the SQLite library. It enables |
| 26 | you to type in queries interactivly, issue them to SQLite and see the |
| 27 | results. Alternativly, you can specify SQL code on the commandline. In |
| 28 | addition it provides a number of meta-commands. |
| 29 | |
| 30 | .SH DESCRIPTION |
| 31 | This manual page documents briefly the |
| 32 | .B sqlite |
| 33 | command. |
| 34 | This manual page was written for the Debian GNU/Linux distribution |
| 35 | because the original program does not have a manual page. |
| 36 | .SS GETTING STARTED |
| 37 | .PP |
| 38 | To start the sqlite program, just type "sqlite" followed by the name |
| 39 | the file that holds the SQLite database. If the file does not exist, a |
| 40 | new one is created automatically. The sqlite program will then prompt |
| 41 | you to enter SQL. Type in SQL statements (terminated by a semicolon), |
| 42 | press "Enter" and the SQL will be executed. |
| 43 | |
| 44 | For example, to create a new SQLite database named "ex1" with a single |
| 45 | table named "tbl1", you might do this: |
| 46 | .sp |
| 47 | .nf |
| 48 | $ sqlite ex1 |
| 49 | SQLite version 2.0.0 |
| 50 | Enter ".help" for instructions |
| 51 | sqlite> create table tbl1(one varchar(10), two smallint); |
| 52 | sqlite> insert into tbl1 values('hello!',10); |
| 53 | sqlite> insert into tbl1 values('goodbye', 20); |
| 54 | sqlite> select * from tbl1; |
| 55 | hello!|10 |
| 56 | goodbye|20 |
| 57 | sqlite> |
| 58 | .sp |
| 59 | .fi |
| 60 | |
| 61 | .SS SQLITE META-COMMANDS |
| 62 | .PP |
| 63 | Most of the time, sqlite just reads lines of input and passes them on |
| 64 | to the SQLite library for execution. But if an input line begins with |
| 65 | a dot ("."), then that line is intercepted and interpreted by the |
| 66 | sqlite program itself. These "dot commands" are typically used to |
| 67 | change the output format of queries, or to execute certain prepackaged |
| 68 | query statements. |
| 69 | |
| 70 | For a listing of the available dot commands, you can enter ".help" at |
| 71 | any time. For example: |
| 72 | .sp |
| 73 | .nf |
| 74 | .cc | |
| 75 | sqlite> .help |
| 76 | .dump Dump database in a text format |
| 77 | .exit Exit this program |
| 78 | .explain Set output mode suitable for EXPLAIN |
| 79 | .header ON|OFF Turn display of headers on or off |
| 80 | .help Show this message |
| 81 | .indices TABLE Show names of all indices on TABLE |
| 82 | .mode MODE Set mode to one of "line", "column", "list", or "html" |
| 83 | .mode insert TABLE Generate SQL insert statements for TABLE |
| 84 | .output FILENAME Send output to FILENAME |
| 85 | .output stdout Send output to the screen |
| 86 | .schema ?TABLE? Show the CREATE statements |
| 87 | .separator STRING Change separator string for "list" mode |
| 88 | .tables List names all tables in the database |
| 89 | .timeout MS Try opening locked tables for MS milliseconds |
| 90 | .width NUM NUM ... Set column widths for "column" mode |
| 91 | sqlite> |
| 92 | |cc . |
| 93 | .sp |
| 94 | .fi |
| 95 | |
| 96 | .SH OPTIONS |
| 97 | The program has the following options: |
| 98 | .TP |
| 99 | .B \-html |
| 100 | Set output mode to HTML. |
| 101 | .TP |
| 102 | .B \-list |
| 103 | Set output mode to 'list'. |
| 104 | .TP |
| 105 | .B \-line |
| 106 | Set output mode to 'line'. |
| 107 | .TP |
| 108 | .BI \-seperator\ seperator |
| 109 | Specify which output field seperator for 'list' mode to use. |
| 110 | Default is '|'. |
| 111 | |
| 112 | .SH OUTPUT MODE |
| 113 | The SQLite program has different output modes, which define the way |
| 114 | the output (from queries) is formatted. |
| 115 | |
| 116 | In 'list' mode, which is the default, one record per line is output, |
| 117 | each field seperated by the seperator specified with the |
| 118 | \fB-seperator\fP option or \fB.seprator\fP command. |
| 119 | |
| 120 | In 'line' mode, each column is output on its own line, records are |
| 121 | seperated by blank lines. |
| 122 | |
| 123 | In HTML mode, an XHTML table is generated. |
| 124 | |
| 125 | In 'column' mode, one record per line is output, aligned neatly in colums. |
| 126 | |
| 127 | .SH SEE ALSO |
| 128 | http://www.hwaci.com/sw/sqlite/ |
| 129 | .br |
| 130 | The sqlite-doc package |
| 131 | .SH AUTHOR |
| 132 | This manual page was written by Andreas Rottmann <rotty@debian.org>, |
| 133 | for the Debian GNU/Linux system (but may be used by others). |