blob: 31f4b1ca1ff6cbe55d27e6a3a2ce897d3656cc12 [file] [log] [blame]
drh3a88fbd2002-01-07 19:58:43 +00001.\" 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
19sqlite \- A command line interface for SQLite
20.SH SYNOPSIS
21.B sqlite
22.RI [ options ] " filename " [ SQL ]
23.SS SUMMARY
24.PP
25sqlite is a terminal-based front-end to the SQLite library. It enables
26you to type in queries interactivly, issue them to SQLite and see the
27results. Alternativly, you can specify SQL code on the commandline. In
28addition it provides a number of meta-commands.
29
30.SH DESCRIPTION
31This manual page documents briefly the
32.B sqlite
33command.
34This manual page was written for the Debian GNU/Linux distribution
35because the original program does not have a manual page.
36.SS GETTING STARTED
37.PP
38To start the sqlite program, just type "sqlite" followed by the name
39the file that holds the SQLite database. If the file does not exist, a
40new one is created automatically. The sqlite program will then prompt
41you to enter SQL. Type in SQL statements (terminated by a semicolon),
42press "Enter" and the SQL will be executed.
43
44For example, to create a new SQLite database named "ex1" with a single
45table named "tbl1", you might do this:
46.sp
47.nf
48$ sqlite ex1
49SQLite version 2.0.0
50Enter ".help" for instructions
51sqlite> create table tbl1(one varchar(10), two smallint);
52sqlite> insert into tbl1 values('hello!',10);
53sqlite> insert into tbl1 values('goodbye', 20);
54sqlite> select * from tbl1;
55hello!|10
56goodbye|20
57sqlite>
58.sp
59.fi
60
61.SS SQLITE META-COMMANDS
62.PP
63Most of the time, sqlite just reads lines of input and passes them on
64to the SQLite library for execution. But if an input line begins with
65a dot ("."), then that line is intercepted and interpreted by the
66sqlite program itself. These "dot commands" are typically used to
67change the output format of queries, or to execute certain prepackaged
68query statements.
69
70For a listing of the available dot commands, you can enter ".help" at
71any time. For example:
72.sp
73.nf
74.cc |
75sqlite> .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
91sqlite>
92|cc .
93.sp
94.fi
95
96.SH OPTIONS
97The program has the following options:
98.TP
99.B \-html
100Set output mode to HTML.
101.TP
102.B \-list
103Set output mode to 'list'.
104.TP
105.B \-line
106Set output mode to 'line'.
107.TP
108.BI \-seperator\ seperator
109Specify which output field seperator for 'list' mode to use.
110Default is '|'.
111
112.SH OUTPUT MODE
113The SQLite program has different output modes, which define the way
114the output (from queries) is formatted.
115
116In 'list' mode, which is the default, one record per line is output,
117each field seperated by the seperator specified with the
118\fB-seperator\fP option or \fB.seprator\fP command.
119
120In 'line' mode, each column is output on its own line, records are
121seperated by blank lines.
122
123In HTML mode, an XHTML table is generated.
124
125In 'column' mode, one record per line is output, aligned neatly in colums.
126
127.SH SEE ALSO
128http://www.hwaci.com/sw/sqlite/
129.br
130The sqlite-doc package
131.SH AUTHOR
132This manual page was written by Andreas Rottmann <rotty@debian.org>,
133for the Debian GNU/Linux system (but may be used by others).