You can change the database by use of the. By default a transient in-memory database is opened. run the command ‘sqlite3’ This should open the SQLite shell and present a screen similar to that below. You can also run the SQL statements contained in a file by directing the contents of the file to the standard input of sqlite3 like this: $ sqlite3 db.sqlite < commands. Open a command prompt (cmd.exe) and ‘cd’ to the folder location of the SQLSAFI.sqlite database file. You can run an SQL statement on the command line without entering the interactive shell simply by adding the SQL statement in quotation marks after the name of the database: $ sqlite3 db.sqlite "SELECT * FROM test" See the current rows of the table: sqlite> SELECT * from TEST Įach row is displayed with the fields separated by the | character. Sqlite> INSERT INTO test VALUES(5, 'goodbye') You can now insert some rows into this table: sqlite> INSERT INTO test VALUES(100, 'hello') You can create a table named test with the integer field f1 and the text field f2 like so: sqlite> CREATE TABLE test(f1 INTEGER, f2 TEXT) To execute a SQL statement, simply type it in and press enter. ![]() These two dot commands will enable this behavior for your session: sqlite>. When working with small databases it is nice if the results of a SELECT statment has the columns line up and there is a header row. help will list all of the available dot commands. Special SQLite commands (called dot commands in the documentation) start with a dot (. Once you have entered the interactive shell you should see something like this: SQLite version 3.13.0 10:57:30 If db.sqlite does not yet exist, it will be created for you as an empty database. If you want interact with the database stored in the file db.sqlite, run the following: $ sqlite3 db.sqlite See the official Command Line Shell documentation for more detail. The most common useful features are described below. An interactive session opens up a shell where you can run SQL statements and SQLite commands. Use the sqlite3 command line tool to open an interactive session. This tutorial has nice concise well-written information.Here are links to different sections of the official SQLite documentation. This page may be updated as we cover more features of SQLite.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |