Commands in SQLite

SQLite Commands

SQLite commands can be either of the three types:


1. Data Definition Language (DDL):

It includes three commands:


To create a table, a view of a table or other object in the database.


To modify an existing database object like a table.


To delete an entire table, a view of a table or other object in the database.


2. Data Manipulation Language (DML):

It also includes three commands:


To create a record.


To modify the records.


To delete records.


3. Data Query Language (DQL):

It includes only one command:


To retrieve certain records from one or more tables.


SQLite dot Commands:

The dot commands are not terminated by a semicolon (;). To check the list of dot commands use the “.help” command. Below is a list of some popular SQLite dot commands.




.backup ?db? file

To backup DB to file.

.bail on|off

Stops after hitting an error. Its default state is off.


To list the names and the files of the attached databases.

.dump ?table?

To dump the database in an sql text format. It only dumps the tables matching like pattern table, if it is specified.

.echo on|off

To turn the command echo on or off.


To exit the sqlite prompt.

.explain on|off

To turn the output mode suitable for explain on or off. Its default state is on.

.header(s) on|off

To turn the display of headers on or off.


To check the list of dot commands.

.import file table

To import data from file into table.

.indices ?table?

To show names of all indices or to show the indices for tables matching like pattern table, if thee table iis specified.

.load file ?entry?

To load an extension library.

.log file|off

To turn logging on or off.

.mode mode

To set the output mode.

.nullvalue string

To print string in place of null values.

.output filename

To send output to a file.

.output stdout

To send output to the screen.

.print string…

To print literal string.

.prompt main continue

To replace the standard prompts.


To exit the sqlite prompt.

.read filename

To execute the sql in filename.

.schema ?table?

To show the create statements.

.separator string

To change the separator used by output mode and .import.


To show the current values for various settings.

.stats on|off

To turn the stats on or off.

.tables ?pattern?

To list names of tables matching like a pattern.

.timeout ms

To try opening locked tables for ms milliseconds.

.width num num

To set the column widths for “column” mode.

.timer on|off

To turn the cpu timer measurement on or off.


Special dot commands:

There are three special dot commands including; .header on, .mode column and .timer on. There are special as they are used to format the output.


Please follow and like us:
Content Protection by