Appendix B. sqlite3 Command Reference

The sqlite3 program is a command-line interface, or shell, that allows the user to interactively issue SQL commands and display the results. This can be used to try out queries, test existing databases, debug problems, or just play around and learn SQL. The sqlite3 program is similar to the mysql application for MySQL, the pgsql application for PostgreSQL, the sqlplus application for Oracle, or the sqlcmd application for SQL Server.

Once sqlite3 has started up and opened a database, the main sqlite> prompt is displayed. At this point, SQL statements can be entered. SQL statements should be terminated with a semicolon, and will be executed immediately. The results (if any) will then be displayed. When the database is ready to execute a new statement, the main command prompt will appear.

Longer SQL statements can be entered on multiple lines. In this case, additional lines will display the continue ...> prompt, which indicates this line is continuation of the previous line or lines. Remember to enter a semicolon to terminate and execute an SQL statement.

The sqlite3 source code is included in most SQLite distributions as the source file shell.c. This, along with the amalgamation files, are all that is required to build the sqlite3 application. For more information on building sqlite3, and what options are available, see Building and Appendix A.

A number of other third-party, general-purpose, shell-type programs exist for SQLite, including a number ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.