If you want to find tables based on a specific pattern, you use the. The following commands open a new database connection to the chinook database and display the tables in the database. To display all the tables in the current database, you use the. exit Code language: Shell Session ( shell ) Show tables in a database To exit the sqlite3 program, you use the. databasesĬode language: Shell Session ( shell ) Exit sqlite3 tool database command again, the sqlite3 returns two databases: main and chinook. ![]() sqlite> ATTACH DATABASE "c:\sqlite\db\chinook.db" AS chinook Code language: Shell Session ( shell ) The following statement adds the chinook database to the current connection. To add an additional database in the current connection, you use the statement ATTACH DATABASE. databases command displays at least one database with the name: main.įor example, the following command shows all the databases of the current connection: sqlite>. To show all databases in the current connection, you use the. help Code language: Shell Session ( shell ) Show databases in the current database connection ![]() To show all available commands and their purpose, you use the. Sqlite> Code language: Shell Session ( shell ) Show all available commands and their purposes If you start a session with a database name that does not exist, the sqlite3 tool will create the database file.įor example, the following command creates a database named sales in the C:\sqlite\db\ directory: > sqlite3 c:\sqlite\db\sales.db If you want to open a specific database file when you connect to the SQlite database, you use the following command: > sqlite3 c:\sqlite\db\chinook.db open c:\sqlite\db\chinook.db Code language: Shell Session ( shell ) The following statement opens the chinook.db database: sqlite>. Sqlite> Code language: Shell Session ( shell )īy default, an SQLite session uses the in-memory database, therefore, all changes will be gone when the session ends. Use ".open FILENAME" to reopen on a persistent database. To start the sqlite3, you type the sqlite3 as follows: > sqlite3Ĭonnected to a transient in-memory database. The SQLite project delivers a simple command-line tool named sqlite3 (or sqlite3.exe on Windows) that allows you to interact with the SQLite databases using SQL statements and commands. ![]() Summary: in this tutorial, we will introduce you to the most commonly used SQLite commands of the sqlite3 command-line program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |