![]() changes on|off Show number of rows changed by SQL ![]() cd DIRECTORY Change the working directory to DIRECTORY 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 Manage SQL archives: ".archive -help" for details 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 input lines that begin with a dot (".") are 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 temporary storage, then save that database into a disk file using the ".save" command: SQLite version 3.16.0 19:48:46 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 "ex1.db" file is created if it does not previously exist. The example above causes the database file named "ex1.db" to be opened and used. 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. However, because double-clicking starts the sqlite3.exe without command-line arguments, no database file will have been specified, so SQLite will use a temporary database that is deleted 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. ![]() Terminate the sqlite3 program by typing your system 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 On startup, the sqlite3 program will show a brief banner message then prompt you to enter SQL. If no database file is specified on the command-line, a temporary database is created, then deleted when the "sqlite3" program exits. If the named file does not exist, a new database file with the given name will be created automatically. Start the sqlite3 program by typing "sqlite3" at the command prompt, 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 program named sqlite3 (or sqlite3.exe on Windows) that allows the user to manually enter and execute SQL statements against an SQLite database. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |