Skip to Main Content
Using SQLite
book

Using SQLite

by Jay A. Kreibich
August 2010
Intermediate to advanced content levelIntermediate to advanced
526 pages
23h 39m
English
O'Reilly Media, Inc.
Content preview from Using SQLite

Command-Line Options

The sqlite3 tool understands the following command-line format:

sqlite3 [options...] [database [SQL_string]]

Options are given first, followed by an optional database filename. This database will be opened as the main database. If the database file does not exist, it will be created. If no database filename is given (or an empty string is given), a file-backed temporary database will be created. If the database name :memory: is given, an in-memory database will be created.

If a database filename is given, an optional SQL string can be provided. This string may consist of one or more SQL statements separated by semicolons. The SQL statements need to be passed as a single argument, so they will most likely need to be enclosed in quotes. If present, sqlite3 will open the database file, execute the provided SQL statements, and exit. Dot-commands cannot be included in the SQL string. If no SQL string is given, sqlite3 will provide an interactive prompt and accept either SQL or dot-commands from the terminal interface.

The interactive startup sequence will attempt to locate and open the .sqliterc init file in the current user’s home directory. If the file exists, lines will be read and executed before any other processing (including the command-line SQL string). The init file may contain both dot-commands and SQL statements. All SQL statements must end in a semicolon. The init file is processed before the command-line options. This allows the command-line options to override ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning SQL, 3rd Edition

Learning SQL, 3rd Edition

Alan Beaulieu
High Performance MySQL, 4th Edition

High Performance MySQL, 4th Edition

Silvia Botros, Jeremy Tinley

Publisher Resources

ISBN: 9781449394592Errata PageSupplemental Content