Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Sqlite3 Cheat Sheet: by Via

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

sqlite3 Cheat Sheet

by Richard Holloway (richardjh) via cheatography.com/478/cs/370/

sqlite3 Meta Commands sqlite3 Meta Commands (cont) sqlite3 Options

.backup ?DB? FILE .output stdout -init file

Backup DB (default "​mai​n") to FILE Send output to the screen Read and execute commands from file ,
which can contain a mix of SQL statements
.bail ON|OFF .prompt MAIN CONTINUE
and meta-c​omm​ands.
Stop after hitting an error. Default OFF Replace the standard prompts
-echo
.databases .quit
Print commands before execution.
List names and files of attached databases Exit this program
-[no]h​eader
.dump ?TABLE? ... .read FILENAME
Turn headers on or off.
Dump the database in an SQL text format. Execute SQL in FILENAME
-bail
.echo ON|OFF .restore ?DB? FILE
Stop after hitting an error.
Turn command echo on or off Restore content of DB (default "​mai​n") from
FILE -inter​active
.exit
Force intera​ctive I/O .
Exit this program
sqlite3 Meta Commands contd. -batch
.explain ?ON|OFF?
.schema ?TABLE? Force batch I/O .
Turn output mode suitable for EXPLAIN on
Show the CREATE statements -column
or off.
.separator STRING Query results will be displayed in a table like
.header(s) ON|OFF
form, using whitespace characters to
Change separator used by output mode and
Turn display of headers on or off separate the columns and align the output.
.import
.help -csv
.show
Shows this inform​ation. Set output mode to CSV (comma separated
Show the current values for various settings
.import FILE TABLE values).
.stats ON|OFF
Import data from FILE into TABLE -html
Turn stats on or off
.indices ?TABLE? Query results will be output as simple HTML
.tables ?TABLE? tables.
Show names of all indices
List names of tables -line
.load FILE ?ENTRY?
.timeout MS Query results will be displayed with one
Load an extension library
Try opening locked tables for MS value per line, rows separated by a blank
.log FILE|off millis​econds line. Designed to be easily parsed by scripts
or other programs
Turn logging on or off. FILE can be
.width NUM1 NUM2 ...
stderr​/stdout -list
Set column widths for "​col​umn​" mode
.mode MODE ?TABLE? Query results will be displayed with the
.timer ON|OFF
Set output mode where MODE is one of: separator (|, by default) character between
Turn the CPU timer measur​ement on or off each field value. The default.
csv, column, html, insert, line, list, tabs, tcl
-separator separator
.nullvalue STRING
sqlite3 See Also
Set output field separator. Default is '|'.
Print STRING in place of NULL values
http:/​/ww​w.s​qli​te.org/
.output FILENAME The sqlite​3-doc package.
Send output to FILENAME

By Richard Holloway (richardjh) Published 13th May, 2012. Sponsored by CrosswordCheats.com


cheatography.com/richardjh/ Last updated 2nd June, 2014. Learn to solve cryptic crosswords!
richardjh.org Page 1 of 2. http://crosswordcheats.com
sqlite3 Cheat Sheet
by Richard Holloway (richardjh) via cheatography.com/478/cs/370/

sqlite3 Options (cont)

-stats

Print memory stats before each finalize.

-nullvalue string

Set string used to represent NULL values. Default is '' (empty


string).

-version

Show SQLite version.

-vfs name

Use name as the default VFS .

-help

Show help on options and exit.

By Richard Holloway (richardjh) Published 13th May, 2012. Sponsored by CrosswordCheats.com


cheatography.com/richardjh/ Last updated 2nd June, 2014. Learn to solve cryptic crosswords!
richardjh.org Page 2 of 2. http://crosswordcheats.com

You might also like