The available commands differ by version and build options, so they are not listed here. Meta-commands are always prefixed with a dot (.).Ī list of available meta-commands can be viewed at any time by issuing the '.help' command. The interactive interpreter offers a set of meta-commands that can be used to control the output format, examine the currently attached database files, or perform administrative operations upon the attached databases (such as rebuilding indices). $ sqlite3 -line mydata.db 'select * from memos where priority > 20 ' ![]() Multiple statements should be separated by semi-colons. Optionally, a SQL statement or set of SQL statements can be supplied as a single argument. This is useful for migrating data between databases, possibly changing the schema along the way. ATTACH can also be used to attach to multiple databases within the same interactive session. If no database name is supplied, the ATTACH sql command can be used to attach to existing or create new database files. Sqlite> insert into memos values('lunch with Christine', 100) Sqlite> insert into memos values('deliver project description', 10) Sqlite> create table memos(text, priority INTEGER) If the database file does exist, it will be opened.įor example, to create a new database file named "mydata.db", create a table named "memos" and insert a couple of records into that table: If the database file does not exist, it will be created. To start a sqlite3 interactive session, invoke the sqlite3 command and optionally provide the name of a database file. sqlite3 can also be used within shell scripts and other applications to provide batch processing features. Sqlite3 is a terminal-based front-end to the SQLite library that can evaluate queries interactively and display the results in multiple formats. Execute an SQL statement against a database and then exit: sqlite3 path/to/database.sqlite3 ' SELECT * FROM some_table '.Open an interactive shell against an existing database: sqlite3 path/to/database.sqlite3. ![]() Start an interactive shell with a new database: sqlite3.A command line interface for SQLite version 3 Examples (TL DR)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |