SQLite Dot Commands
Overview
SQLite dot commands are special commands that can be used in the SQLite CLI( command prompt) to perform various tasks, such as managing the database schema, setting options, and controlling the display format.
SQLite Dot Commands are commands that we execute at the SQLite command prompt( sqlite> ). These commands are called dot commands because they start with a dot ( . ) symbol.
Syntax
The general syntax of the command is as follows:
sqlite>.<command>
Note that there is no space between sqlite> prompt and the dot command. Unlike SQLite statements, these commands do not require a semi-colon (;) to terminate.
SQLite Dot Commands
Type the following command at the prompt to get the complete list of dot commands.
sqlite>.help
Some of the dot commands are as follows:
SQLite Dot Command | Description |
.databases | List the database names and files of the attached databases. |
.tables | This command lists all the tables in the current database. |
.help | Show help text. We can also provide patterns for context help. |
.clone <newdb> | This command is used to clone data from the existing current database into the <newdb>. |
.dbinfo ?db? | This command displays the status information about the database. For example, like page_size, page_count, text encoding, schema size, etc. |
.dbconfig ?option? ?value? | The .dbconfig command is used to list or change sqlite3_db_config() options. |
.import <file> <table> | This command imports the data from <file> into the database <table>. |
.exit | This command will exit the SQLite prompt ( sqlite> ). The control is switched back to the Windows prompt. |
It’s important to note that these commands in SQLite are not to be confused with SQL commands used in your queries. Dot commands only apply to SQLite’s command-line interface and are used to manage the environment and access information about the database and its structure.
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: