load FILE ?ENTRY? Load an extension library limit ?LIMIT?VAL? Display or change the value of an SQLITE_LIMIT If TABLE specified, only show indexes for tables indexes ?TABLE? Show names of all indexes import FILE TABLE Import data from FILE into TABLE headers on|off Turn display of headers on or off fullschema Show schema and the content of sqlite_stat tables explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN If TABLE specified, only dump tables matching dbinfo ?DB? Show status information about the database databases List names and files of attached databases clone NEWDB Clone data into NEWDB from the existing database changes on|off Show number of rows changed by SQL binary on|off Turn binary output on or off. bail on|off Stop after hitting an error. backup ?DB? FILE Backup DB (default "main") to FILE These "dot commands" are typically used to change the output format of queries, or to execute certain prepackaged query statements.įor a listing of the available dot commands, you can enter ".help" at any time. But if an input line begins with a dot ("."), then that line is intercepted and interpreted by the sqlite3 program itself. Most of the time, sqlite3 just reads lines of input and passes them on to the SQLite library for execution. Special commands to sqlite3 (dot-commands) As with the ".open" command, you might want to use a full pathname with forward-slash directory separators to avoid ambiguity. īe careful when using the ".save" command as it will overwrite any preexisting database files having the same name without prompting for confirmation. In other words use "c:/work/ex1.db", not "c:\work\ex1.db".Īlternatively, you can create a new database using the default in-memory storage, then save that database into a disk file using the ".save" command: SQLite version 3.8.5 12:36:14 Use forward-slashes as the directory separator character. You might want to use a full pathname to ensure that the file is in the directory that you think it is in. The example above causes the database file named "ex1.db" to be opened and used, and created if it does not previously exist. Use ".open FILENAME" to reopen on a persistent database. To use a persistent disk file as the database, enter the ".open" command immediately after the terminal window starts up: SQLite version 3.8.5 12:36:14Ĭonnected to a transient in-memory database. Note, however, that by default this SQLite session is using an in-memory database, not a file on disk, and so all changes will be lost when the session exits. Windows users can double-click on the sqlite3.exe icon to cause the command-line shell to pop-up a terminal window running SQLite. This feature allows you to enter SQL commands that span multiple lines. If you omit the semicolon, sqlite3 will give you a continuation prompt and wait for you to enter more text to be added to the current SQL command. Make sure you type a semicolon at the end of each SQL command! The sqlite3 program looks for a semicolon to know when your SQL command is complete. Use the interrupt character (usually a Control-C) to stop a long-running SQL statement. You can terminate the sqlite3 program by typing your systems End-Of-File character (usually a Control-D). Sqlite> insert into tbl1 values('goodbye', 20) Sqlite> insert into tbl1 values('hello!',10) Sqlite> create table tbl1(one varchar(10), two smallint) Type in SQL statements (terminated by a semicolon), press "Enter" and the SQL will be executed.įor example, to create a new SQLite database named "ex1" with a single table named "tbl1", you might do this: $ sqlite3 ex1 When started, the sqlite3 program will show a brief banner message then prompt you to enter SQL. If no database file is specified, a temporary database is created, then deleted when the "sqlite3" program exits. If the file does not exist, a new database file with the given name will be created automatically. To start the sqlite3 program, just type "sqlite3" optionally followed by the name the file that holds the SQLite database. This document provides a brief introduction on how to use the sqlite3 program. The SQLite project provides a simple command-line utility named sqlite3 (or sqlite3.exe on windows) that allows the user to manually enter and execute SQL statements against an SQLite database. The C language interface to SQLite Version 2 Upgrading SQLite, Backwards Compatibility Locking And Concurrency In SQLite Version 3 NULL Handling in SQLite Versus Other Database Engines An Introduction To The SQLite C/C InterfaceĬ-language Interface Specification for SQLite
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |